- 谁拿了最多奖学金
- 2014-11-03 14:12:41 @
#include<stdio.h>
struct money
{char name[40];
int qimo;
int clas;
int su;
int west;
int word;
int cent;
int paim;
};
int main()
{
int n,i;
scanf("%d",&n);
struct money RMB[n];
for(i=0;i<n;i++)
{scanf("%s",RMB[i].name);
scanf("%d%d",&RMB[i].qimo,&RMB[i].clas);
char p,q;
scanf(" %c %c",&p,&q);
if(p=='Y')
RMB[i].su=1;
else
RMB[i].su=0;
if(q=='Y')
RMB[i].west=1;
else
RMB[i].west=0;
scanf("%d",&RMB[i].word);
RMB[i].paim=i;
}
for(i=0;i<n;i++)
{
RMB[i].cent=0;
if(RMB[i].word>0&&RMB[i].qimo>80)
RMB[i].cent+=8000; //院士
if(RMB[i].clas>80&&RMB[i].qimo>85)
RMB[i].cent+=4000; //五四(班级评议)
if(RMB[i].qimo>90)
RMB[i].cent+=2000; //成绩
if(RMB[i].west==1&&RMB[i].qimo>85)
RMB[i].cent+=1000; //西部
if(RMB[i].su==1&&RMB[i].qimo>80)
RMB[i].cent+=850; //班级(干部)
}
int j,k,tmp;
for(j=0;j<n;j++)
for(k=j+1;k<n;k++)
if(RMB[k].cent>RMB[j].cent)
{tmp=RMB[k].paim; RMB[k].paim=RMB[j].paim; RMB[j].paim=tmp;}
int sum=0;
for(i=0;i<n;i++)
sum+=RMB[i].cent;
for(i=0;i<n;i++)
if(RMB[i].paim==0)
{printf("%s\n",RMB[i].name);
printf("%d\n",RMB[i].cent);
printf("%d",sum);
}
getch();
return 0;
}