随笔分类 - 题目 / ABC
摘要:C link 记录一下每个鸽笼里鸽子的个数和每个鸽子的位置,维护一下有几个笼子里有两个以上的鸽子。 点击查看代码 #include<bits/stdc++.h> using namespace std; int n,q; int gs[1000005]; int wz[1000005]; int c
阅读全文
摘要:C link 手写队列存下开始位置和长度,模拟即可。 点击查看代码 #include<bits/stdc++.h> #define int long long using namespace std; int q; struct nd{ int st,len; }a[300005]; int h =
阅读全文
摘要:好像已经很久没有写过题解了 C link 对于每一个糕点,二分查找大于等于它大小的二倍的糕点的位置(可以用 函数),从这个位置到 就是可以和这个糕点配对的糕点。 猜猜我是啥 #include<bits/stdc++.h> #define int long lo
阅读全文
摘要:C link 我们找到第 个段的结尾和第 个段的开头和结尾,当输出到第 个段的结尾时,输出第 个段,也就是第 个段的开头到结尾个 ,当输出到第 个段的开头时,直接跳到第 个段的结尾。 那么怎么找第 个段的结尾和第\(
阅读全文
摘要:C link 由于只能往后放,显而易见,如果可以达到要求,那么一定只有一种方式。所以重心就在判断是否可行上了。 首先,如果总数量不等于 肯定不行。 其次,如果第一堆不在 肯定不行。 最后,如果到了某个点的时候石头总和不够 到这个点的数量一定是不行的。 那么在统计答案的时候,我
阅读全文
摘要:C link 存一下那些点不能占,用总数减去即可,注意存的时候可以用一个 ,存过的就不要再存了。 神奇的代码 #include<bits/stdc++.h> #define int long long using namespace std; int n,m; int ans; int
阅读全文
摘要: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
阅读全文
摘要:A link 判断 , 之间可不可以放一个数,如果可以就是 个,不行就是 个(左右),但是如果 , 相等就只有一个。 点击查看代码 #include<bits/stdc++.h> using namespace std; signed main(){
阅读全文
摘要: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 先判断一下时间是否跨天,如果跨天了,把后一个加上 ,使后一个大于前一个,再判断国王喊的时间或喊的时间加 是否在范围内。 神奇的代码 #include<bits/stdc++.h> using namespace std; signed main(){ int a,b
阅读全文
摘要:A link 判断一下少的那个人加上剩下的所有票是否会超过另一个人,如果超过,不确定,否则目前票多的必胜。 神奇的代码 #include<bits/stdc++.h> using namespace std; signed main(){ int n,a,b; cin >> n >> a >> b;
阅读全文
摘要: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; int n; string s[105]; signed main(){ cin >> n; for(int i =
阅读全文
摘要: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 判断即可。。。 点击查看代码 #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 n,k,x; signed main(){ cin >> n >> k >> x; for(int i = 1;i
阅读全文
摘要: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 循环加每一个数,加到哪个数不能加了输出前一个数,注意如果加到最后还能加,记得输出 。 点击查看代码 #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; int n,l,r; signed main(){ cin
阅读全文
摘要: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
阅读全文