得10分,第二个就没有过,但是数据下下来,在本地是对的,不知道为什么
查看原帖
得10分,第二个就没有过,但是数据下下来,在本地是对的,不知道为什么
1385157
chenjianyyzz楼主2024/8/14 06:24
#include <bits/stdc++.h>
using namespace std;
int score11[6000][3]={0}, score21[6000][3]={0};
int cnt11=1, cnt21=1;
int main()
{
	string remain="";
	bool findE = false;
	for (int i=1; i<=2500; i++)
	{
		//if find E, break
		string s;
		getline(cin,s); 
		for (int j=0; j<s.length(); j++)
		{
			if (s[j] == 'E') 
			{
				findE = true;
				break;
			}
			if (s[j] == 'W')
			{
				score11[cnt11][1]++; 
				score21[cnt21][1]++;
			} else if (s[j]='L')
			{
				score11[cnt11][2]++; 
				score21[cnt21][2]++;
			} ;
				 
			if ((score11[cnt11][1]>=11 || score11[cnt11][2]>=11) && (abs(score11[cnt11][1]-score11[cnt11][2])>=2))
				cnt11++;
			if ((score21[cnt21][1]>=21 || score21[cnt21][2]>=21) && (abs(score21[cnt21][1]-score21[cnt21][2])>=2))
				cnt21++;	
		}
		if (findE) break;
	}
	
	//判断是否需要会退一个
	if (cnt11>1)		//*******至少需要有一个结果 
		if (score11[cnt11][1]==0 && score11[cnt11][2]==0) cnt11--;
	if (cnt21>1)
		if (score21[cnt21][1]==0 && score21[cnt21][2]==0) cnt21--;
		
		
	for (int i=1; i<=cnt11; i++)
		cout << score11[i][1]<<":"<<score11[i][2]<<endl;
	cout << endl;
	for (int i=1; i<=cnt21; i++)
		cout << score21[i][1]<<":"<<score21[i][2]<<endl;
	return 0;
 } 
2024/8/14 06:24
加载中...