摘要:
A. TreeScript 令 \(f_u\) 表示 \(u\) 及 \(u\) 子树中的节点都创建的最小数量。 如果 \(u\) 只有一个儿子,那么可以将子树最后一个节点存储在当前的 \(u\) 中,答案就是 \(f_v\)。 若 \(u\) 有多个儿子: 令 \(t=\max\limits_{v 阅读全文
posted @ 2023-09-27 22:23
Zhou_JK
阅读(414)
评论(1)
推荐(1)
摘要:
CF1447A Add Candies 可以将操作看做将 \(a_i\) 减 \(i\),然后第 \(i\) 次操作 \(i\) 就是合法的。 #include<iostream> #include<cstdio> using namespace std; int T; int n; void so 阅读全文
posted @ 2023-09-27 22:22
Zhou_JK
阅读(76)
评论(0)
推荐(0)
摘要:
CF1440A Buy the String 每个点有两种决策,要么选当前的字符,要么选跟当前字符不同的字符,取个较小值相加。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int T; int 阅读全文
posted @ 2023-09-27 22:21
Zhou_JK
阅读(23)
评论(0)
推荐(0)
摘要:
CF1438A Specific Tastes of Andre 全 \(1\) 就是合法的。 #include<iostream> #include<cstdio> using namespace std; const int N=105; int T; int n; void solve() { 阅读全文
posted @ 2023-09-27 22:21
Zhou_JK
阅读(18)
评论(0)
推荐(0)
摘要:
CF1197A DIY Wooden Ladder 答案为 \(\min(a_{n-1},n-2)\)。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; 阅读全文
posted @ 2023-09-27 22:20
Zhou_JK
阅读(36)
评论(0)
推荐(0)
摘要:
CF1195A Drinks Choosing 先将相同权值的配对直到只剩下一个,然后再配剩下的单个。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int n,k; int a[N]; int 阅读全文
posted @ 2023-09-27 22:20
Zhou_JK
阅读(38)
评论(0)
推荐(0)
摘要:
CF1162A Zoning Restrictions Again 每个位置越高越好,暴力模拟即可。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,h,m; int a[N]; int m 阅读全文
posted @ 2023-09-27 22:19
Zhou_JK
阅读(16)
评论(0)
推荐(0)
摘要:
CF1079A Kitchen Utensils 令 \(c_i\) 表示餐具 \(i\) 出现的数量,最小的餐具套数为 \(t=\lceil \frac{\max\{c_i\}}{k}\rceil\),按照这个计算就好了。 #include<iostream> #include<cstdio> # 阅读全文
posted @ 2023-09-27 22:19
Zhou_JK
阅读(13)
评论(0)
推荐(0)
摘要:
CF1072A Golden Plate 第 \(i\) 个矩形的周长为 \(2(w - 4(i - 1))+2(h - 4(i - 1))-4\),枚举 \(i\) 求和。 #include<iostream> #include<cstdio> using namespace std; int n 阅读全文
posted @ 2023-09-27 22:18
Zhou_JK
阅读(26)
评论(0)
推荐(0)
摘要:
CF1036A Function Height 答案为 \(\lceil \frac{k}{n}\rceil\)。 #include<iostream> #include<cstdio> using namespace std; long long n,k; int main() { scanf(" 阅读全文
posted @ 2023-09-27 22:17
Zhou_JK
阅读(28)
评论(0)
推荐(0)
摘要:
CF1020A New Building for SIS 分类讨论 \(a,b\) 两个端点的几种情况就好了,特判 \(t_a=t_b\) 的情况。 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> usi 阅读全文
posted @ 2023-09-27 22:17
Zhou_JK
阅读(39)
评论(0)
推荐(0)
摘要:
CF1011A Stages 每次记下上一个选的位置,贪心能填就填。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,k; char s[N]; int cnt[27]; int main( 阅读全文
posted @ 2023-09-27 22:15
Zhou_JK
阅读(14)
评论(0)
推荐(0)
摘要:
CF1008A Romaji 直接模拟。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=105; int n; char s[N]; int main() { scanf( 阅读全文
posted @ 2023-09-27 22:15
Zhou_JK
阅读(68)
评论(0)
推荐(1)
摘要:
CF996A Hit the Lottery 直接贪心尽可能的分配到 \(k_5\),剩下的依次分配给 \(k_4,k_3,k_2,k_1\)。 #include<iostream> #include<cstdio> using namespace std; int n; int k[6]; int 阅读全文
posted @ 2023-09-27 22:14
Zhou_JK
阅读(83)
评论(0)
推荐(0)
摘要:
CF992A Nastya and an Array 答案为非零数的个数。 #include<iostream> #include<cstdio> #include<map> using namespace std; const int N=100005; int n; int a[N]; map< 阅读全文
posted @ 2023-09-27 22:14
Zhou_JK
阅读(38)
评论(0)
推荐(0)
摘要:
CF957A Tritonic Iridescence 如果原序列中有两个相同的字符,显然不合法。 如果开头或者结尾为 ?,或者有两个连续的 ?,或者一个 ? 两边的字符不同显然合法。 否则一定不合法。 #include<iostream> #include<cstdio> using namesp 阅读全文
posted @ 2023-09-27 22:13
Zhou_JK
阅读(41)
评论(0)
推荐(0)
摘要:
CF935A Fafa and his Company 大概是 \(n\) 的因数个数减一? #include<iostream> #include<cstdio> #include<cmath> using namespace std; int n; int main() { scanf("%d" 阅读全文
posted @ 2023-09-27 22:12
Zhou_JK
阅读(28)
评论(0)
推荐(0)
摘要:
交配 / Crossing 令 J 为 \(0\),O 为 \(1\),I 为 \(2\),杂交相当于是 \(c\equiv -(a+b)\pmod 3\) 可以发现最后的状态数不会超过 \(27\) 种,直接暴力线段树维护即可。 #include<iostream> #include<cstdio 阅读全文
posted @ 2023-09-27 21:58
Zhou_JK
阅读(61)
评论(0)
推荐(0)
摘要:
バブルソート 2 / Bubble Sort 2 可以发现,答案即为 \(\max\limits_{i=1}^n \sum\limits_{j=1}^{i-1}[a_j>a_i]\)。 因为是 \(\max\),所以可能成为答案只有后缀最小值,可以把式子改写成 \(\max\limits_{i=1} 阅读全文
posted @ 2023-09-27 20:57
Zhou_JK
阅读(39)
评论(0)
推荐(0)
摘要:
ビルの飾り付け 4 / Building 4 令 \(f_{i,0/1,j}\) 表示到第 \(i\) 位,第 \(i\) 位选的是 \(A_i/B_i\),\(1\sim i\) 选了 \(j\) 个 \(A_i\) 是否合法。 可以发现,对于一个 \(f_{i,0/1,j}\),合法的 \(j\ 阅读全文
posted @ 2023-09-27 20:37
Zhou_JK
阅读(31)
评论(0)
推荐(0)