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 |
不明白,大虾帮忙!!!!#include<iostream> #include<cstring> using namespace std; int main() { int n; cin >> n; int p,pe;pe= 0;int i,s,tp; char name[100],temp[100]; int sub[4],time[4]; while(n--){ s = 0; cin >> temp; for(i = 0;i< 4;i ++) { cin >> sub[i] >> time[i]; if(time[i])s += 1; } if(s < p) continue; else { tp = 0; for(i = 0;i < 4;i ++) if(time[i]) tp += (time[i] + 20 * (sub[i]-1)); if(s > p) { p = s; pe = tp; strcpy(name,temp); } else if(pe > tp) { p = s; pe = tp; strcpy(name,temp); } } } cout << name <<' '<<p <<' ' <<pe << 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