Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
一次AC水过,贴给初学者#include <iostream> using namespace std; typedef struct { char name[30]; int solved; int ppoint; } team; team t[100]; int main() { int index; int i, j; int n; cin>>n; int sub[4]; int time[4]; int minppoint = 9999999; int maxsolved = -1; for(i=0; i<n; i++) { cin>>t[i].name; t[i].solved = 0; t[i].ppoint = 0; for(j=0; j<4; j++) { cin>>sub[j]>>time[j]; if(time[j] != 0) { t[i].solved++; t[i].ppoint += (20 * (sub[j] - 1) + time[j]); } }//end of 4 problems if(t[i].solved == maxsolved) { if(t[i].ppoint < minppoint) { minppoint = t[i].ppoint; maxsolved = t[i].solved; index = i; } } else if(t[i].solved > maxsolved) { minppoint = t[i].ppoint; maxsolved = t[i].solved; index = i; } }//end of n teams cout<<t[index].name<<" "<<t[index].solved<<" "<<t[index].ppoint<<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator