标签:
#include<stdio.h>
#include<string.h>
int main()
{
int test,i,geshu,k,a[1100];
scanf("%d\n",&test);
while(test--)
{
int flag=0,sum=0;
struct
{
char name[20];
int qimo;
int banyi;
char ganbu;
char xibu;
int lunwen;
int jiangjin;
}score[1100];
scanf("%d",&geshu);
for(i=0;i<geshu;i++)
score[i].jiangjin=0;
/*for(i=0;i<geshu;i++)
{
scanf("%s%d%d%c%c%d",score[i].name,&score[i].qimo,&score[i].banyi,&score[i].ganbu,&score[i].xibu,&score[i].lunwen);
}*/
for(i=0;i<geshu;i++)
{
scanf("%s %d %d %c %c %d",score[i].name,&score[i].qimo,&score[i].banyi,&score[i].ganbu,&score[i].xibu,&score[i].lunwen);
}
for(i=0;i<geshu;i++)
{
if(score[i].qimo>80&&score[i].lunwen>=1)
score[i].jiangjin+=8000;
if(score[i].qimo>85&&score[i].banyi>80)
score[i].jiangjin+=4000;
if(score[i].qimo>90)
score[i].jiangjin+=2000;
if(score[i].qimo>85&&score[i].xibu==‘Y‘)
score[i].jiangjin+=1000;
if(score[i].banyi>80&&score[i].ganbu==‘Y‘)
score[i].jiangjin+=850;
}
for(i=0;i<geshu;i++)
{
sum+=score[i].jiangjin;
a[i]=score[i].jiangjin;
}
for(i=0;i<geshu;i++)
for(k=i+1;k<geshu;k++)
if(score[i].jiangjin<score[k].jiangjin)
{
int temp=score[i].jiangjin;
score[i].jiangjin=score[k].jiangjin;
score[k].jiangjin=temp;
}
for(i=0;i<geshu;i++)
if(score[0].jiangjin==a[i])
{
flag=i;
break;
}
printf("%s %d %d\n",score[flag].name,a[flag],sum);
}
}
标签:
原文地址:http://www.cnblogs.com/mycapple-zgs-111411/p/4619676.html