P1042,只过了第一个点,剩下5个WA和4个RE 孩子调了快一个小时了,但是不知道错在哪了QAQ 程序跑下来cmd显示的输出和.out文件对比后一样,但是洛谷不给过 求大佬指点orz 代码如下
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
char ch[2600];
int main()
{
char temp;
int i=0,cnt11=0,j=0,countleft=0,countright=0;
temp=getchar();
while (temp!='E')
{
if(temp!='\n')
{
ch[i++]=temp;
temp=getchar();
}
else
temp=getchar();
}
if(i==0)
{
cout<<"0:0"<<endl<<endl<<"0:0";
}
else
{
for(j=0;j<i;j++)
{
if(ch[j]=='W')
countleft++;
else
countright++;
cnt11++;
if((max(countleft,countright)>=11&&abs(countleft-countright)>=2)||j==i-1)
{
cout<<countleft<<":"<<countright<<endl;
countleft=0;
countright=0;
cnt11=0;
}
}
countleft=0;
countright=0;
cnt11=0;
cout<<endl;
for(j=0;j<i;j++)
{
if(ch[j]=='W')
countleft++;
else
countright++;
cnt11++;
if((max(countleft,countright)>=21&&abs(countleft-countright)>=2)||j==i-1)
{
cout<<countleft<<":"<<countright<<endl;
countleft=0;
countright=0;
cnt11=0;
}
}
}
return 0;
}
球球了,多谢各位大佬