上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: Codeforces Round 861 (Div. 2) C题直接数位dp即可 #include<cstdio> #include<algorithm> #include<cstring> #include<map> #include<queue> #include<bitset> #includ 阅读全文
posted @ 2024-01-17 08:47 gan_coder 阅读(16) 评论(0) 推荐(0)
摘要: abc132F - Small Products 容易想到暴力dp,f[i][j]表示到第i个位置,且i位置上填的是j的方案数。 虽然N非常大,但是如果我们考虑按\(\frac{n}{k}\)的值分块,那么就只有根号级别的数量 \(f[i][j]\)表示在到第i个位置,且第i个位置选了第j个块中的数 阅读全文
posted @ 2024-01-16 09:48 gan_coder 阅读(28) 评论(0) 推荐(0)
摘要: 知道这个套路才比较easy \(a_n=(a+\sqrt{b})^n ,b_n=(a-\sqrt{b})^n\)且\(0<b_n<1\) 令\(c_n=a_n+b_n\),所以 \(c_n=\lceil a_n \rceil\) 联系递推方程 \(F_n=pF_{n-1}+qF_{n-2}\) \( 阅读全文
posted @ 2024-01-15 15:44 gan_coder 阅读(8) 评论(0) 推荐(0)
摘要: Read the program below carefully then answer the question. pragma comment(linker, "/STACK:1024000000,1024000000") include include include include incl 阅读全文
posted @ 2024-01-15 15:22 gan_coder 阅读(15) 评论(0) 推荐(0)
摘要: 设\(t_n=a_n*b_n\) 把\(a_n 和b_n\)拆出来 \(t_n=(a_{n-1}*ax+ay)(b_{n-1}*bx+by)\) \(t_n=ax*bx*t_{n-1}+ax*by*a_{n}+ay*bx*b_{n-1}+ay*by\) 那么同时维护\(s_n, t_n, a_n, 阅读全文
posted @ 2024-01-15 15:04 gan_coder 阅读(12) 评论(0) 推荐(0)
摘要: 4576. 素数独立集 首先很明显是一个最大独立集问题 然后可以发现这是一张二分图 因为如果存在奇环的话就和根据唯一分解定理矛盾 二分图中 最大独立集=n-最大匹配 阅读全文
posted @ 2024-01-14 23:06 gan_coder 阅读(17) 评论(0) 推荐(0)
摘要: abc333F - Bomb Game 2 设\(f_{i,j}\)表示在有i个人的队列中,第j个人成为第一个的概率。 \(f_{n,1}=\frac{1}{2}f_{n,n}\) \(f_{n,2}=\frac{1}{2}f_{n-1,1}+\frac{1}{2}f_{n,1}\) ... \(f 阅读全文
posted @ 2024-01-12 15:07 gan_coder 阅读(28) 评论(0) 推荐(0)
摘要: abc335F - Hop Sugoroku 首先容易想到\(O(n^2)\)的dp 考虑优化,对于一个i,只会对满足\(i+a[i]*x=j\)的j有贡献。 也就是j%a[i]=i%a[i] 那么我们可以延迟转移,用cnt[a[i]][i%a[i]],来记录贡献, 然后我们数组不可能开那么大,所以 阅读全文
posted @ 2024-01-12 10:56 gan_coder 阅读(17) 评论(0) 推荐(1)
摘要: 首先容易想到lca+线性基,\(O(nlognB^2+qlognB^2)\),显然T飞了。 #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<map> #include<vector> #i 阅读全文
posted @ 2023-12-06 13:19 gan_coder 阅读(32) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1898 C题可以造一个大小为4的环,然后再造一个来回,这样就解决了%4=0,%4=2的情况,而奇数的情况显然无解。 #include<cstdio> #include<algorithm> #include<cstring> #incl 阅读全文
posted @ 2023-11-29 20:38 gan_coder 阅读(23) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页