- 谁拿了最多奖学金
- 2016-07-04 21:25:58 @
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct student{
char name[25];
int test;
int judge;
char position;
char area;
int text;
int sum;
int flag;
}STU;
int main()
{
int N;
STU *A;
int i;
STU *p;
int max;
int h=0;
scanf("%d",&N);
A=(STU*)malloc(N);
for(i=0;i<N;i++)
{
scanf("%s %d %d %c %c %d",(A+i)->name,&(A+i)->test,&(A+i)->judge,&(A+i)->position,&(A+i)->area,&(A+i)->text);
(A+i)->flag=0;
(A+i)->sum=0;
}
for(i=0;i<N;i++)
{
if((A+i)->test>80&&(A+i)->text>=1)
((A+i)->sum)+=8000;
if((A+i)->test>85&&(A+i)->judge>80)
((A+i)->sum)+=4000;
if((A+i)->test>90)
((A+i)->sum)+=2000;
if((A+i)->test>85&&(A+i)->area=='Y')
((A+i)->sum)+=1000;
if((A+i)->judge>80&&(A+i)->position=='Y')
((A+i)->sum)+=850;
}
max=A->sum;
p=A;
for(i=0;i<N;i++)
{
if((A+i)->sum>max)
{
p=(A+i);
max=p->sum;
}
}
p->flag=1;
for(i=0;i<N;i++)
{
if((A+i)->sum==p->sum)
(A+i)->flag=1;
}
for(i=0;i<N;i++)
{
if((A+i)->flag==1)
{
printf("%s\n",(A+i)->name);
break;
}
}
printf("%d\n",(A+i)->sum);
for(i=0;i<N;i++)
{
h+=(A+i)->sum;
}
printf("%d\n",h);
return 0;
}