1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include<bits/stdc++.h> using namespace std; struct student{ char name[1000]; int shen; int it; }; int main() { int n; int i,j; int flag=0; struct student s[105]; scanf ( "%d" ,&n); for (i=0;i<n;i++) scanf ( "%s%d%d" ,s[i].name,&s[i].shen,&s[i].it); int maxe=0; int xia; for (i=0;i<n;i++) if (maxe<s[i].shen) { maxe=s[i].shen; xia=i; } for (i=0;i<n;i++) for (j=0;j<n;j++) if (i==xia&&j==xia&&j!=i) { int t=s[i].it>s[j].it?1:0; if (t) printf ( "%s %d %d\n" ,s[i].name,s[i].shen,s[i].it); else printf ( "%s %d %d\n" ,s[j].name,s[j].shen,s[j].it); } else if (i==j&&(i==xia||j==xia)) { printf ( "%s %d %d\n" ,s[i].name,s[i].shen,s[i].it); } return 0; } /************************************************************** Problem: 1175 User: as21nizhiyi Language: C++ Result: 答案错误 ****************************************************************/ |