# 3006 scholarship calculation

Time Limit: 1000/1000MS (C++/Others) Memory Limit: 65536/65536KB (C++/Others)
Total Submissions: 160 Accepted Submissions: 107
Problem Description
It is the practice of a school to grant scholarships after the final examination of each semester. There are five kinds of scholarships, with different conditions:

1. Academician scholarship, 8000 yuan per person, with an average score of more than 80 (> 80) at the end of the term, and students who have published one or more papers in this semester can be awarded;
2. The May 4th scholarship is 4000 yuan per person. Students with a final average score of more than 85 (> 85) and a class evaluation score of more than 80 (> 80) can be awarded;
3. The outstanding achievement award is 2000 yuan per person. Students with an average score of more than 90 (> 90) at the end of the term can receive it;
4. The Western scholarship is 1000 yuan per person. Students from western provinces with an average score of more than 85 (> 85) at the end of the term can obtain it;
5. The class contribution award is 850 yuan per person. Student cadres with class evaluation scores higher than 80 (> 80) can be awarded;
As long as you meet the conditions, you can win the award. There is no limit on the number of winners of each scholarship, and each student can also get multiple scholarships at the same time. For example, Yao Lin's final average score is 87 points, and his class evaluation score is 82 points. At the same time, he is also a student cadre, so he can get the May 4th scholarship and class contribution award at the same time. The total amount of bonus is 4850 yuan.
Now give the relevant data of some students. Please calculate which students get the highest total amount of bonuses (assuming that there are always students who can meet the conditions for obtaining scholarships).

Input
The first line of input is an integer n (1 < = n < = 100), representing the total number of students. In the next n rows, each row is the data of a student. From left to right, it is the name, final average score, class evaluation score, whether it is a student cadre, whether it is a student from western provinces, and the number of papers published. The name is a string composed of upper and lower case English letters with a length of no more than 20 (excluding spaces); The final average score and class evaluation score are integers between 0 and 100 (including 0 and 100); Whether it is a student cadre and whether it is a student in western provinces are represented by one character respectively, Y means yes and N means no; The number of papers published is an integer from 0 to 10 (including 0 and 10). Every two adjacent data items are separated by a space.

Output
The output consists of three lines. The first line is the name of the student who received the most bonus, and the second line is the total amount of bonus received by this student. If two or more students receive the most bonuses, output the name of the student who appears first in the input file. The third line is the total number of scholarships received by these N students.

Sample Input
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
Sample Output
ChenRuiyi
9000
28700

```#include <stdio.h>
#include <string.h>
int yuanshi(int ave_scoreHS1,int SCIHS)
{
if(ave_scoreHS1>80&&SCIHS>0)
return 8000;
else
return 0;
}
int wusi(int ave_scoreHS2,int B_scoreHS1)
{
if(ave_scoreHS2>85&&B_scoreHS1>80)
return 4000;
else
return 0;
}
int youxiu(int ave_scoreHS3)
{
if(ave_scoreHS3>90)
return 2000;
else
return 0;
}
int xibu(int ave_scoreHS4,char xbHS)
{
if(ave_scoreHS4>85&&xbHS=='Y')
return 1000;
else
return 0;
}
int gongxian(int B_scoreHS2,char gbHS)
{
if(B_scoreHS2>80&&gbHS=='Y')
return 850;
else
return 0;
}
int main()
{
int N,SCI,YS,WS,YX,XB,GX,sum=0,Psum=0;
int i,ave_score,B_score,p,maxsum=0;
char name,gb,xb,stmp,maxname;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%s %d %d %c %c %d",&name,&ave_score,&B_score,&gb,&xb,&SCI);
YS=yuanshi(ave_score,SCI);
WS=wusi(ave_score,B_score);
YX=youxiu(ave_score);
XB=xibu(ave_score,xb);
GX=gongxian(B_score,gb);
Psum=YS+WS+YX+XB+GX;
if(Psum>maxsum)
{
maxsum=Psum;
strcpy(maxname,name);
}
sum=sum+Psum;
}
printf("%s\n%d\n%d",maxname,maxsum,sum);
return 0;
}
```

Keywords: C++

Added by Centrek on Wed, 09 Mar 2022 12:36:53 +0200