AtCoder Grand Contest 021完整题解】的更多相关文章

提示:如果公式挂了请多刷新几次,MathJex的公式渲染速度并不是那么理想. 总的来说,还是自己太弱了啊.只做了T1,还WA了两发.今天还有一场CodeForces,晚上0点qwq... 题解还是要好好写的. A - Digit Sum 2 Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement Find the maximum possible sum of the digits (in bas…
AtCoder Grand Contest 031 Atcoder A - Colorful Subsequence description 求\(s\)中本质不同子序列的个数模\(10^9+7\).两个子序列不同当且仅当存在一种字符在两者中的出现次数不同. \(|s|\le10^5\) solution \(\prod_{i='a'}^{'z'}(\mbox{字符}i\mbox{出现的次数}+1)-1\) #include<cstdio> #include<algorithm>…
传送门 \(A\) 咕咕 ll n,res;bool fl; int main(){ scanf("%lld",&n),fl=1; while(n>9)res+=9,fl&=(n%10==9),n/=10; printf("%lld\n",res+n-1+fl); return 0; } \(B\) 只有凸包上的点有贡献,且把以这个点为端点的两条凸包上的线的中垂线画出来,它的概率就是两条中垂线的夹角除以\(2\pi\) //quming #in…
A - Digit Sum 2 Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N. Constraints 1≤N≤1016 N is an integer. Input Input is give…
A - Grouping 2 Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups cons…
从这里开始 比赛目录 Problem A Connection and Disconnection 简单讨论即可. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 105; #define ll long long int n, K; char s[N]; vector<int> len; void work() { for (int i = 1, j =…
Atcoder 题面传送门 & 洛谷题面传送门 首先我们考虑设 \(dp_{i,j}\) 表示对于一个 \(i\times j\) 的网格,其每行都至少有一个黑格的合法的三元组 \((A,B,C)\) 的个数,那么对于原来的 \(n\times m\) 的网格,如果其存在黑格的行的集合不同,那么三元组 \((A,B,C)\) 肯定不同,因此我们可以直接枚举有多少行存在黑格来计算答案,即 \(ans=\sum\limits_{i=0}^n\dbinom{n}{i}dp_{i,m}\),因此我们只需…
Description Takahashi has decided to give a string to his mother. The value of a string T is the length of the longest common subsequence of T and T', where T' is the string obtained by reversing T. That is, the value is the longest length of the fol…
从这里开始 比赛目录 A < B < E < D < C = F,心情简单.jpg. Problem A >< 把峰谷都设成 0. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 5e5 + 5; int n; char s[N]; int L[N], R[N]; int main() { scanf("%s",…
从这里开始 题目目录 Problem A XOR Circle 你发现,权值的循环节为 $a_0, a_1, a_0\oplus a_1$,然后暴力即可. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 1e5 + 5; int n; int a[N], b[N]; void quitif(boolean condition, const char* vert = &q…