合集-ABC
摘要:A link 其实,有人赢比赛,就有人输比赛,一加一减,不管进行多少场比赛,最后所有人的分数和一定是\(0\)。 那么知道\(n-1\)个人的分数和,就可以知道第\(n\)个人的了。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n;
阅读全文
摘要:A link 这道题就先输出整个的\(oox\),再输出剩一个两个的。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n; signed main(){ cin >> n; int t = n/3; for(int i = 1;i <
阅读全文
摘要:A link 很简单 遍历,判断模\(k\)是否为\(0\),如果为\(0\),输出\(a_i/k\)。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n,k; int a[105]; signed main(){ cin >> n
阅读全文
摘要:C link 我们可以把所有字母都存上,代表换到最后这个字母换成什么了,当然最开始就是它本身。 那么,把\(c\)改成\(d\)的时候,就只要把所有等于\(c\)的都改成\(d\)就行了。 点击查看代码 #include<bits/stdc++.h> using namespace std; int
阅读全文
摘要:E link 这个题目中所说的好的其实就是像\(010101\)这样一个\(0\),一个\(1\)的字符串。 那么不好的就是两个\(0\)或两个\(1\)在一起,所以判断一个区间好不好只需要判断一个区间内有没有两个\(0\)或两个\(1\)在一起,那么我们可以把两个\(0\)或两个\(1\)在一起的
阅读全文
摘要:\(\huge{C}\) link 首先,考虑暴力,用一个堆,存所有数,每次拿出最大的数,拆开加入堆,计入答案,直到最大的\(\le1\),时间复杂度\(O(\text{不能过})\)。 考虑想求出\(n\),要什么。 求\(n\)一定是第一次把\(n\)拆成\(\lfloor{\frac{n}{2
阅读全文
摘要:A link 把最后三位取成数字,判断是否小于\(349\),大于\(1\),不等于\(316\)。 点击查看代码 #include<bits/stdc++.h> using namespace std; char s[10]; int ans; signed main(){ cin >> s+1;
阅读全文
摘要:A link 算出两个队分别得了几分,让木青队的总得分比高桥队多\(1\)即可。 点击查看代码 #include<bits/stdc++.h> using namespace std; int gq,mq; signed main(){ int x; for(int i = 1;i <= 9;++
阅读全文
摘要:A link \(x\)停不到,\(y\)能停到。 要先判断是从前往后还是从后往前。 点击查看代码 #include<bits/stdc++.h> using namespace std; signed main(){ int n,x,y,z; cin >> n >> x >> y >> z; if
阅读全文
摘要:A link 暴力寻找\(2\)及以后比\(a_1\)大的数。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n; int a[105]; signed main(){ cin >> n; for(int i = 1;i <= n;+
阅读全文
摘要:A link 模拟整个过程即可。 点击查看代码 #include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int h; cin >> h; int day = 1ll,g = 0ll; whil
阅读全文
摘要:A link 把\(1\) ~ \({l-1}\)和\({r+1}\) ~ \(n\)部分顺序输出\(l\)~\(r\)部分逆序输出。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n,l,r; signed main(){ cin
阅读全文
摘要:A link 循环加每一个数,加到哪个数不能加了输出前一个数,注意如果加到最后还能加,记得输出\(n\)。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n,m; int h[105],sum; signed main(){ cin
阅读全文
摘要:A link …… 点击查看代码 #include<bits/stdc++.h> using namespace std; string s,t; signed main(){ cin >> s >> t; if(s == "AtCoder"&&t == "Land") cout << "Yes";
阅读全文
摘要:A link 先输出前\(k\)个,再输出\(x\),最后输出后面的。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n,k,x; signed main(){ cin >> n >> k >> x; for(int i = 1;i
阅读全文
摘要:A link 判断即可。。。 点击查看代码 #include<bits/stdc++.h> using namespace std; int r,g,b; string c; signed main(){ cin >> r >> g >> b >> c; if(c == "Red") cout <<
阅读全文
摘要:A link 判断即可。 点击查看代码 #include<bits/stdc++.h> using namespace std; int r; signed main(){ cin >> r; if(r < 100) cout << 100-r; else if(r < 200) cout << 2
阅读全文
摘要:A link 循环判断,除了最后两个点以外,有连续\(2\)个甜的就不能吃完。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n; string s[105]; signed main(){ cin >> n; for(int i =
阅读全文
摘要:A link 题目已经说的很明白了,判断即可。 点击查看代码 #include<bits/stdc++.h> using namespace std; int y; signed main(){ cin >> y; if(y%4 != 0) cout << 365; else if(y%4 == 0
阅读全文
摘要:A link 判断一下少的那个人加上剩下的所有票是否会超过另一个人,如果超过,不确定,否则目前票多的必胜。 神奇的代码 #include<bits/stdc++.h> using namespace std; signed main(){ int n,a,b; cin >> n >> a >> b;
阅读全文
摘要:A link 先判断一下时间是否跨天,如果跨天了,把后一个加上\(24\),使后一个大于前一个,再判断国王喊的时间或喊的时间加\(24\)是否在范围内。 神奇的代码 #include<bits/stdc++.h> using namespace std; signed main(){ int a,b
阅读全文
摘要:A link 先输出后面,在输出前面。 神奇的代码 #include<bits/stdc++.h> using namespace std; int n,k; int a[105]; signed main(){ cin >> n >> k; for(int i = 1;i <= n;++ i){
阅读全文
摘要:A link 判断\(A\),\(B\)之间可不可以放一个数,如果可以就是\(3\)个,不行就是\(2\)个(左右),但是如果\(A\),\(B\)相等就只有一个。 点击查看代码 #include<bits/stdc++.h> using namespace std; signed main(){
阅读全文
摘要:A link 判断。 点击查看代码 #include<bits/stdc++.h> using namespace std; signed main(){ int l,r; cin >> l >> r; if(l == 1&&r == 0) cout << "Yes"; else if(l == 0
阅读全文
摘要:C link 存一下那些点不能占,用总数减去即可,注意存的时候可以用一个\(map\),存过的就不要再存了。 神奇的代码 #include<bits/stdc++.h> #define int long long using namespace std; int n,m; int ans; int
阅读全文
摘要:C link 由于只能往后放,显而易见,如果可以达到要求,那么一定只有一种方式。所以重心就在判断是否可行上了。 首先,如果总数量不等于\(n\)肯定不行。 其次,如果第一堆不在\(1\)肯定不行。 最后,如果到了某个点的时候石头总和不够\(1\)到这个点的数量一定是不行的。 那么在统计答案的时候,我
阅读全文
摘要:C link 我们找到第\(k-1\)个段的结尾和第\(k\)个段的开头和结尾,当输出到第\(k-1\)个段的结尾时,输出第\(k\)个段,也就是第\(k\)个段的开头到结尾个\(1\),当输出到第\(k\)个段的开头时,直接跳到第\(k\)个段的结尾。 那么怎么找第\(k-1\)个段的结尾和第\(
阅读全文
摘要:好像已经很久没有写过题解了 C link 对于每一个糕点,二分查找大于等于它大小的二倍的糕点的位置(可以用\(lower_{}bound\)函数),从这个位置到\(n\)就是可以和这个糕点配对的糕点。 猜猜我是啥 #include<bits/stdc++.h> #define int long lo
阅读全文
摘要:C link 手写队列存下开始位置和长度,模拟即可。 点击查看代码 #include<bits/stdc++.h> #define int long long using namespace std; int q; struct nd{ int st,len; }a[300005]; int h =
阅读全文
摘要:D link 首先考虑比较暴力的怎么做。 我们考虑一个前缀和的数组\(qzh_{0/1,i}\)代表\(1\)~\(i\)中\(0/1\)的个数。 那么如果我们让区间\(l\)~\(r\)(因为区间长度可以为\(0\),所以\(r \geq l-1\))是\(1\),答案就是\(qzh_{1,l-1
阅读全文

浙公网安备 33010602011771号