萌新求助,输出和.out文件一样但是没有分
  • 板块学术版
  • 楼主Moonastger
  • 当前回复8
  • 已保存回复8
  • 发布时间2022/12/13 12:56
  • 上次更新2023/10/24 07:49:02
查看原帖
萌新求助,输出和.out文件一样但是没有分
799866
Moonastger楼主2022/12/13 12:56

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;
}


球球了,多谢各位大佬

2022/12/13 12:56
加载中...