4 right wrong give-up right right right wrong right right right right right
(3,30) (1,20)(2,20)
#include<iostream> #include<string> using namespace std; int main() { struct S{ int All; int Nu; }; struct S st[3]; for(int i=0;i<3;i++) { st[i].All=0; st[i].Nu=i+1; } int n; cin>>n; string A[n][3]; for(int i=0;i<n;i++) { for(int j=0;j<3;j++) { cin>>A[i][j]; } } for(int i=0;i<3;i++) { for(int j=0;j<n;j++) { if(A[j][i]=="right") { st[i].All+=10; } else if(A[j][i]=="wrong") { st[i].All-=10; } } } struct S t; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { if(st[j].All<st[j+1].All) { t=st[j]; st[j]=st[j+1]; st[j+1]=t; } } } for(int i=0;i<3;i++) { if(i>0){ if(st[i].All!=st[i-1].All) { cout<<endl; } } cout<<"("<<st[i].Nu<<","<<st[i].All<<")"; } return 0; }
OpenJudge百炼习题解答(C++)--题2704:竞赛评分
原文:http://blog.csdn.net/u014581901/article/details/50725581