2.5 点球大战

#include
#include
using namespace std;
int main()
{
	int N;
	while(cin>>N&&N)
	{
		cin.get();
		string s,s1="",s2="";	
		int cnt1=0,cnt2=0;
		for(int i=1;i<=N;i++)
		{ 
			getline(cin,s);
			int flag=1;
			if(s.find(" no good")!=string::npos) flag=0;
			if(flag==1&&i%2!=0) { s1+="O "; cnt1++; }
			if(flag==1&&i%2==0) { s2+="O "; cnt2++; }
			if(flag==0&&i%2!=0) s1+="X ";
			if(flag==0&&i%2==0) s2+="X ";
		}
		if(s1.length()!=s2.length()) s2+="- ";
		for(int k=1;k<=ceil(N/2.0);k++)
			cout<<k<<" ";
		cout<<"Score"<<endl<<s1<<cnt1<<endl<<s2<<cnt2<<endl;
	}
} 

你可能感兴趣的:(2.5 点球大战)