社区讨论
WA#6#10 求调必关
P1042[NOIP 2003 普及组] 乒乓球参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mjp1s51g
- 此快照首次捕获于
- 2025/12/28 09:25 2 个月前
- 此快照最后确认于
- 2025/12/31 11:45 2 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
#define int long long
char c;
int h21=0,d21=0,h11=0,d11=0,t1=1,t2=1;
int h2[3005],d2[3005],h1[3005],d1[3005];
signed main()
{
while(cin>>c)
{
if(c=='W')
{
h11++;
h21++;
}else if(c=='L')
{
d11++;
d21++;
}else if(c=='E') break;
if((h11>=11&&h11-d11>=2)||(d11>=11&&d11-h11>=2))
{
h1[t1]=h11;
d1[t1]=d11;
t1++;
h11=0;
d11=0;
}
if((h21>=21&&h21-d21>=2)||(d21>=21&&d21-h21>=2))
{
h2[t2]=h21;
d2[t2]=d21;
t2++;
h21=0;
d21=0;
}
}
for(int i=1;i<=t1-1;i++) cout<<h1[i]<<":"<<d1[i]<<endl;
if(h11!=0||d11!=0||t1==1) cout<<h11<<":"<<d11<<endl;
cout<<endl;
for(int i=1;i<=t2-1;i++) cout<<h2[i]<<":"<<d2[i]<<endl;
if(h21!=0||d21!=0||t2==1) cout<<h21<<":"<<d21<<endl;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...