从这里开始 比赛目录 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 =…
提示:如果公式挂了请多刷新几次,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…
从这里开始 比赛目录 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",…
题目链接:https://atcoder.jp/contests/abc129/tasks/abc129_e 题目大意 给定一个二进制表示的数 L,问有多少对自然数 (a, b) 满足 $a + b \leq L 且 a + b = a \oplus b $. 分析 由于异或是无进位相加,所以 $a + b = a \oplus b $ 等价于 a 和 b 的每一位对应二进制位都不会是两个 1. 设 L 有 n 个 1.按 L 中的顺序编号为 n~1. 设 L(i) 为编号为 i 的 1 到 L…
题目大意:给定一个 N 个点的序列,求有多少个区间满足\(\oplus_{i=l}^ra[i]=\sum\limits_{i=l}^ra[i]\). 题解: 小结论:\(a\oplus b=a+b\rightarrow a\&b=0\). 对每个点来说,考虑向右延伸能够满足条件的右端点的位置,显然右端点的位置单调不减,双指针扫一遍即可. 代码如下 #include <cstdio> using namespace std; const int maxn=2e5+10; int n,a[…
Problem 1603 - Minimum Sum Time Limit: 2000MS Memory Limit: 65536KB Total Submit: 623 Accepted: 178 Special Judge: No Description There are n numbers A[1] , A[2] .... A[n], you can select m numbers of it A[B[1]] , A[B[2]] ... A[B[m]] ( 1 <= B[…
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…