50分求助

P1042 [NOIP2003 普及组] 乒乓球

我没仔细看,就提醒一个易错点: >直到分差大于或者等于2,才一局结束。 如果你21盘或者11盘算完了,分差小于2,你就得往后再算。 下面提供AC代码,绝对不要抄。 ```cpp #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> using namespace std; bool bol[62505]={0}; int main() { string str=""; char ch='A'; int t=0; while(ch!='E'){ ch=getchar(); if(ch=='W'){ bol[t++]=1; } else if(ch=='L'){ bol[t++]=0; } } int times=t; // for(int i=0;i<times;i++){ // cout<<bol[i]; // } int a=0,b=0; for(int i=0;i<times;i++){ // cout<<"---"<<endl; if(bol[i])a++; else b++; // cout<<"a:"<<a<<endl; // cout<<"b:"<<b<<endl; if((a-b>=2||b-a>=2)&&(a>=11||b>=11)){ cout<<a<<":"<<b<<endl; a=0; b=0; } } cout<<a<<":"<<b<<endl; cout<<endl; a=0; b=0; for(int i=0;i<times;i++){ if(bol[i])a++; else b++; if((a-b>=2||b-a>=2)&&(a>=21||b>=21)){ cout<<a<<":"<<b<<endl; a=0; b=0; } } cout<<a<<":"<<b<<endl; return 0; } ```
by _Cppsteve_ @ 2021-08-06 17:51:43


看你提交了很多遍挺可怜的,给你一个笑话段子。 ``` 我有一个特异功能, 我的眼睛可以飞出来 ∑( Д )ﻌﻌﻌﻌ⊙ ⊙, 又飞回去了 ∑(⊙Д⊙) 飞出来了 ∑( Д )ﻌﻌﻌﻌ⊙ ⊙ 飞回去了 ∑(⊙Д⊙), 飞出来了 ∑( Д )ﻌﻌﻌﻌ⊙ ⊙ 飞回去了 ∑(⊙Д⊙).... ```
by _Cppsteve_ @ 2021-08-06 17:55:34


@[Cppsteve](/user/479296) 哟西哟西
by lalaouye @ 2021-08-07 22:31:08


|