样例,数据都是对的,但只A了两个点,求助!!!
查看原帖
样例,数据都是对的,但只A了两个点,求助!!!
576617
xxxx100楼主2023/3/31 19:24
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
    register int x=0,f=1;
    register char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<3)+(x<<1)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
inline void write(int x,char lst=0)
{
	if(x<0)
	{
		x=~(x-1);
		putchar('-');
	}
	if(x>9) write(x/10);
	putchar(x%10+48);
	if(lst) putchar(lst);
}
signed main()
{
	//freopen("C:\\Users\\mty01\\Downloads\\P1042_2.in","r",stdin);
	//freopen("C:\\Users\\mty01\\Downloads\\P1042_2.ans","w",stdout);
	char ch;
	int wl21[29764][2],wl11[56821][2],cnt21=0,cnt11=0;
	int w11=0,l11=0,w21=0,l21=0;
	while(ch=getchar())
	{
		if(ch=='\n') ch=getchar();
		if(ch=='E') break;
		if(ch=='W') w11++,w21++;
		else l11++,l21++;
		if(abs(w11-l11)>=2)
		{
			if(max(w11,l11)>=11)
			{
				wl11[cnt11][0]=w11;
				wl11[cnt11++][1]=l11;
				w11=0;
				l11=0;
			}
		}
		if(abs(w21-l21)>=2)
		{
			if(max(w21,l21)>=21)
			{
				wl21[cnt21][0]=w21;
				wl21[cnt21++][1]=l21;
				w21=0;
				l21=0;
			}
		}
	}
	wl11[cnt11][0]=w11;
	wl11[cnt11++][1]=l11;
	wl21[cnt21][0]=w21;
	wl21[cnt21++][1]=l21;
	for(int i=0;i<cnt11;i++) printf("%d:%d\n",wl11[i][0],wl11[i][1]);
	putchar('\n');
	for(int i=0;i<cnt21;i++) printf("%d:%d\n",wl21[i][0],wl21[i][1]);
	return 0;
}

2023/3/31 19:24
加载中...