6 Riise good Ballack good Gerrard no good Lampard no good Fernando Torres good Malouda good 9 Christiano Ronaldo no good Messi no good Giggs good Abidal no good Carrick good Ronaldinho good Rooney good Henry no good Tevez good 0
1 2 3 Score O X O 2 O X O 2 1 2 3 4 5 Score X O O O O 4 X X O X - 1 提示: 空格数要和样例输出一样,否则很可能会被判为“格式错误”(Presentation Error)。
AC代码:
#include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<cstdlib> #include<iomanip> #include<vector> #include<list> #include<map> #include<queue> #include<algorithm> typedef long long LL; using namespace std; int a[50]; int main() { int n; while(cin>>n,n) { getchar(); int t=(n+1)/2; memset(a,-1,sizeof(a)); for(int i=0;i<n;i++) { string s; getline(cin,s); int len=s.size(); if(s.find(" no good")==len-8) a[i]=0; else a[i]=1; } for(int i=1;i<=t;i++) cout<<i<<' '; cout<<"Score"<<endl; int q=0; for(int i=0;i<n;i+=2){ if(a[i]==1) cout<<'O'<<' ', q++; else cout<<'X'<<' '; } cout<<q<<endl; q=0; for(int i=1;i<t*2;i+=2) { if(a[i]==-1) cout<<'-'<<' '; else if(a[i]) cout<<'O'<<' ',q++; else cout<<'X'<<' '; } cout<<q<<endl; } return 0; }