标签:
1 4 YaoLin 87 82 Y N 0 ChenRuiyi 88 78 N Y 1 LiXin 92 88 N N 0 ZhangQin 83 87 Y N 1
ChenRuiyi 9000 28700
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 struct d 6 { 7 char name[20]; 8 int a,b; 9 char str,ch; 10 int mag,total; 11 }; 12 13 bool cmp(d a,d b) 14 { 15 return a.total>b.total; 16 } 17 d num[100]; 18 19 int main() 20 { 21 22 int n; 23 cin>>n; 24 while(n--) 25 { 26 27 int i,m,sum=0; 28 cin>>m; 29 for(i=0;i<m;i++) 30 { 31 num[i].total=0; 32 scanf("%s %d %d %c %c %d",&num[i].name,&num[i].a,&num[i].b,&num[i].str,&num[i].ch,&num[i].mag); 33 if(num[i].a>80&&num[i].mag>=1) 34 num[i].total+=8000; 35 if(num[i].a>85&&num[i].b>80) 36 num[i].total+=4000; 37 if(num[i].a>90) 38 num[i].total+=2000; 39 if(num[i].a>85&&num[i].ch==‘Y‘) 40 num[i].total+=1000; 41 if(num[i].b>80&&num[i].str==‘Y‘) 42 num[i].total+=850; 43 sum+=num[i].total; 44 } 45 sort(num,num+m,cmp); 46 printf("%s\n%d\n%d\n",num[0].name,num[0].total,sum); 47 printf("\n"); 48 } 49 return 0; 50 }
//结构体;
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4556352.html