50分求救!
查看原帖
50分求救!
339007
wulidede楼主2020/6/8 18:47
#include<stdio.h>
#include<string.h>
char a[2505][27];
int main(){
	int len,i,j,numw=0,numl=0,n=0;
	while(fgets(a[n],27,stdin)!=NULL){
		n++;
		for(i=0;i<strlen(a[n-1]);i++){
			if(a[n-1][i]=='E') break;
		}
		if(a[n-1][i]=='E') break;
	}
	for(i=0;i<n;i++){
		len=strlen(a[i]);
		for(j=0;j<len;j++){
			if(a[i][j]=='W') numw++;
			else if(a[i][j]=='L') numl++;	
			if(((numw+numl)!=0&&(numw+numl)%11==0)||a[i][j]=='E'){
				printf("%d:%d\n",numw,numl);
				numw=0;
				numl=0;
			} 
			if(a[i][j]=='E') break;
		}
		if(a[i][j]=='E') break;
	}
	printf("\n");
	for(i=0;i<n;i++){
		len=strlen(a[i]);
		for(j=0;j<len;j++){
			if(a[i][j]=='W') numw++;
			else if(a[i][j]=='L') numl++;	
			if(((numw+numl)!=0&&(numw+numl)%21==0)||a[i][j]=='E'){
				printf("%d:%d\n",numw,numl);
				numw=0;
				numl=0;
			} 
			if(a[i][j]=='E') break;
		}
		if(a[i][j]=='E') break;
	}
	return 0;	
}

#23459测试点过不去,求救!(洛谷上不会就我一个用C语言吧)

2020/6/8 18:47
加载中...