KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解 哦淦我已经菜到被ABC吊打了. A - Century 首先把当前年份减去\(1\),对应的世纪也减去\(1\),然后我们就发现第\(0\)到\(99\)年对应第\(0\)世纪,第\(100\)到\(199\)年对应第\(1\)世纪,以此类推. 答案就是\(\lfloor \frac {N-1} {100} \rfloor\).这里\(\lfloor x \rflo…
[题解]晋升者计数 Promotion Counting [USACO 17 JAN] [P3605] 奶牛们又一次试图创建一家创业公司,还是没有从过去的经验中吸取教训.!牛是可怕的管理者! [题目描述] 奶牛从 \(1\) ~ \(N(1≤N≤1e5)\) 进行了编号,把公司组织成一棵树,\(1\)号奶牛作为总裁(树的根节点).除总裁以外的每头奶牛都有且仅有唯一的一个的上司(即它在树上的父结点).每一头牛\(i\)都有一个不同的能力指数 \(p(i)\),描述了她对其工作的擅长程度.如果奶牛…
从这里开始 比赛目录 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[…
传送门 \(C\ Stones\) 最后肯定形如左边一段白+右边一段黑,枚举一下中间的断点,预处理一下前缀和就可以了 int main(){ // freopen("testdata.in","r",stdin); n=read(),read(s),res=0x3f3f3f3f; fp(i,1,n){ sum[i][0]=sum[i-1][0],sum[i][1]=sum[i-1][1]; ++sum[i][s[i]=='#']; } fp(i,0,n)cmin(r…
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…