
cf
文章平均质量分 50
张小生的先生
你要觉得我博客还行,就点赞加个关注,有意深聊的可以私信,随时欢迎,当然有女性想深聊的我更欢迎,要是男性的话不建议私聊,我跟一大老爷们真聊不起来。我人品五五开,胆小不好色,对女性要求不高但要识大体,样貌看得过去就行,其它的也就那样了。我不仅把这个当作学习博客也当作一个招友的圣地,希望在这里遇见更好的你。
展开
-
Codeforces Round #650 (Div. 3)
emmm,本以为学期末复习是一种不刷题的借口,最后发现只不过是自己偷懒的一种借口。~~A. Short Substrings题解:找一种合适的模拟方法做即可。int main(){ int t; cin >> t; while(t--) { string s,ans=""; cin >> s; ans+=s[0]; for(int i=1;i<s.length();i+=2) ans+=s[i]; cout << ans <原创 2020-06-25 15:21:05 · 179 阅读 · 0 评论 -
[Codeforces Round #716 (Div. 2)] D. Cut and Stick 主席树
题目链接:D. Cut and Stick题意给你一个长度为n的序列,有q次查询,每次查询有一个区间范围[l,r],问如何划分a[l]~a[r],使得各个子序列每个数出现次数不超过⌈len2⌉{ \lceil \frac{len}{2} \rceil}⌈2len⌉,len为划分后的区间长度。注意子序列不一定连续。题解首先这道题我们需要知道任意一个区间内出现次数超过⌈len2⌉{ \lceil \frac{len}{2} \rceil}⌈2len⌉的x是谁。如果出现次数都没有超过说明没有必要划原创 2021-04-20 10:12:35 · 187 阅读 · 1 评论 -
Educational Codeforces Round 104 (Rated for Div. 2) 题解
Educational Codeforces Round 104 (Rated for Div. 2)A. Arenaint a[maxn];int main(){ ios; int t; cin >> t; while (t--) { int n; cin >> n; int minn=inf; for(int i=1;i<=n;i++) { cin >> a[i]; minn=min(minn,a[i]);} int ans=原创 2021-03-04 22:23:21 · 426 阅读 · 2 评论 -
Codeforces Round #704 (Div. 2) 题解
Codeforces Round #704 (Div. 2)A. Three swimmersint main(){ ios; int t; cin >> t; while (t--) { ll p,a,b,c; cin >> p >> a >> b >> c; ll t1=p/a+(p%a==0?0:1); ll t2=p/b+(p%b==0?0:1); ll t3=p/c+(p%c==0?0:1); t1原创 2021-03-04 21:58:23 · 255 阅读 · 1 评论 -
Codeforces Round #702 (Div. 3) 题解
Codeforces Round #702 (Div. 3)A. Dense Arrayint a[maxn];int main(){ ios; int t; cin >> t; while (t--) { int n; cin >> n; for(int i=1;i<=n;i++) cin >> a[i]; int pre=a[1]; int ans=0; for(int i=2;i<=n;i++) { in原创 2021-03-04 21:37:18 · 537 阅读 · 1 评论 -
Educational Codeforces Round 105 (Rated for Div. 2) 题解
Educational Codeforces Round 105 (Rated for Div. 2)A. ABC String枚举ABC分别为“( ”和 “ )”的情况,然后判断是否为合法字符串。map<char,int> book;string tt="()";string s; bool judge(string ss){ int num=0; for(int i=0;i<ss.length();i++) { if(ss[i]=原创 2021-03-04 21:28:47 · 427 阅读 · 1 评论 -
Codeforces Round #698 (Div. 2) 题解
Codeforces Round #698 (Div. 2)A. Nezzar and Colorful Balls找数字出现次数最多的个数map<int,int> book;int a[maxn];int main(){ int t; cin >> t; while (t--) { book.clear(); int n; cin >> n; for(int i=1;i<=n;i++) { cin >> a[原创 2021-02-16 12:01:57 · 176 阅读 · 1 评论 -
Codeforces Round #693 (Div. 3) 题解
Codeforces Round #693 (Div. 3)A. Cards for Friends按照题目递归模拟即可int f(int a,int b){ if(a%2 && b%2) return 1; if(a%2==0) return 2*f(a/2,b); else return 2*f(a,b/2);}int main(){ int t; cin >> t; while(t--) { int w,h,n; cin >>原创 2021-01-26 19:42:03 · 139 阅读 · 0 评论 -
Codeforces Round #687 (Div. 2) 题解
题目链接:Codeforces Round #687 (Div. 2)A. Prison Break找四个角到(r,c)的最大距离即可int main(){ int t; cin >> t; while(t--) { int n,m,r,c; cin >> n >> m >> r >> c; int ans=0; ans=max(ans,r-1+c-1); ans=max(ans,r-1+m-c); ans=原创 2020-12-08 12:28:09 · 332 阅读 · 0 评论 -
Educational Codeforces Round 99 (Rated for Div. 2) 题解
题目链接:Educational Codeforces Round 99 (Rated for Div. 2)A. Strange Functions转换题意就是判断字符串长度int main(){ int n; cin >> n; while(n--) { string s; cin >> s; cout << s.length() << endl; }}B. Jumpsint main(){ int t; sc原创 2020-12-06 18:02:32 · 332 阅读 · 0 评论 -
Codeforces Round #686 (Div. 3) 题解
题目链接:Codeforces Round #686 (Div. 3)A. Special Permutation整体向前循环移一位int main(){ int t; cin >> t; while(t--) { int n; cin >> n; for(int i=1;i<=n;i++) { if((i+1)%(n+1)==0) cout << 1 << ' '; else cout <<原创 2020-11-25 22:55:31 · 268 阅读 · 0 评论 -
Codeforces Round #685 (Div. 2) 题解
题目链接:Codeforces Round #685 (Div. 2)A. Subtract or Divide贪心,不难发现除了2的偶数仅有两次操作就行,除了1和3的奇数仅有三次操作;剩下的特判即可。int main(){ int t; cin >> t; while(t--) { int n; cin >> n; if(n%2==0) { if(n==2) cout << 1 << endl; else cout原创 2020-11-22 21:18:52 · 421 阅读 · 0 评论 -
Codeforces Round #684 (Div. 2) 题解
题目链接:Codeforces Round #684 (Div. 2)A. Buy the String贪心 int main(){ int t; cin >> t; while(t--) { int n,c0,c1,h; cin >> n >> c0 >> c1 >> h; string s; cin >> s; int ans=0; if(c0>c1) { if(h+c1<原创 2020-11-20 18:45:10 · 267 阅读 · 0 评论 -
Educational Codeforces Round 98 (Rated for Div. 2) 题解
题目链接:Educational Codeforces Round 98 (Rated for Div. 2)A. Robot Program贪心int main(){ int t; cin >> t; while(t--) { int x,y; cin >> x >> y; if(fabs(x-y)<=1) { cout << x+y << endl; continue; } else原创 2020-11-20 18:25:32 · 487 阅读 · 0 评论 -
Codeforces Round #676 (Div. 2)
A. XORwice题意输入a和b,求 (????⊕????) + (????⊕????) (x为任意值) 的最小值。题解要使(????⊕????) + (????⊕????)最小,言外之意就是将a和b转化为二进制下的公共的1部分被异或,答案其实就是a^b。int main(){ int t; cin >> t; while(t--) { int a,b; cin >> a >> b; cout << (a^b) <<原创 2020-10-18 21:47:29 · 515 阅读 · 0 评论