- 谁拿了最多奖学金
- 2019-10-21 16:53:14 @
#include<stdio.h>
#include<string.h>
#define MAX_LEN 20
int Prize(int score1,int score2,char area,char position,int number);
int main()
{
int score1,score2,i=0,n,count,number,sum=0,prize[100]={0},max;
char area,position,name[100][MAX_LEN]={'\0'};
scanf("%d",&n);
while(getchar()!='\n');
do{
scanf("%s%d%d %c %c%d",&name[i],&score1,&score2,&position,&area,&number);
while(getchar()!='\n');
prize[i]=Prize(score1,score2,area,position,number);
i++;
}while(i<n);
count=i;
max=prize[0];
for(i=0;i<count-1;i++)
{
if(prize[i+1]>max)
{
max=prize[i+1];
}
}
for(i=0;i<count;i++)
{
if(prize[i]==max)
{
puts(name[i]);
printf("%d\n",prize[i]);
}
}
for(i=0;i<count;i++)
{
sum=sum+prize[i];
}
printf("%d",sum);
return 0;
}
int Prize(int score1,int score2,char area,char position,int number)
{
int sum=0;
if(score1>80&&number>=1)
{
sum=sum+8000;
}
if(score1>85&&score2>80)
{
sum=sum+4000;
}
if(score1>90)
{
sum=sum+2000;
}
if(score1>85&&area=='Y')
{
sum=sum+1000;
}
if(score2>80&&position=='Y')
{
sum=sum+850;
}
return sum;
}