1147. Who took the most scholarship
Description
The practice of a school is to grant a scholarship after the final exam of each semester. There are a total of five scholarships, with different conditions:
1) Academician scholarship, 8000 yuan per person, with an average score higher than 80 points (> 80) at the end of the semester. All students who have published one or more papers within the Semester can obtain the scholarship;
2) 4000 scholarship, yuan for each student, with an average score higher than 85 (> 85) at the end of the course, and a score higher than 80 (> 80) for the class evaluation;
3) excellent score: 2000 yuan per person. Students with an average score higher than 90 points (> 90) at the end of the period can receive the prize;
4) Western scholarship, 1000 yuan for each student, with an average score higher than 85 (> 85) at the end of the period;
5) the class Contribution Award is RMB 850 per person. Student cadres with class evaluation scores higher than 80 points (> 80) can receive the award;
If you meet the conditions, you can receive an award. There is no limit on the number of winners of each scholarship. Each student can also receive multiple scholarships at the same time. For example, if Yao Lin's average final score is 87, his class evaluation score is 82, and he is also a student cadre, then he can receive the scholarship and class Contribution Award at the same time, the total prize is 4850 yuan.
Now we provide related data for a number of students. calculate the total number of students that receive the highest prize (assuming that there are always students who can meet the scholarship criteria ).
Input
The first line is an integer N (1 <=n <= 100), indicating the total number of students. In the next n rows, each row contains the data of a student. The data is name, average score at the end of the period, class evaluation score, student cadre, and Western Province respectively, and the number of published papers. The name is a string of no more than 20 characters (excluding spaces) consisting of uppercase and lowercase English letters. The average score at the end of the period and the score for class evaluation are all integers (including 0 and 100) between 0 and 100 ); A single character is used for student cadres and a student in a western province respectively. y indicates yes, N indicates no, and the number of published papers is an integer ranging from 0 to 10 (including 0 and 10 ). Each two adjacent data items are separated by a space.
Output
The output includes three rows. The first row is the name of the student who receives the most prizes, and the second row is the total number of bonuses received by the student. If two or more students receive the most prizes, the first student's name appears in the input file. The third row is the total number of scholarships received by the N students.
Sample Input
4YaoLin 87 82 Y N 0ChenRuiyi 88 78 N Y 1LiXin 92 88 N N 0ZhangQin 83 87 Y N 1
Sample output
ChenRuiyi900028700
// source code of submission 902800, Zhongshan University Online Judge System#include <iostream>#define FOR(i,a,b) for(i=a;i<b;i++)using namespace std;struct Student{ char name[21]; int m1,m2; char c1,c2; int p,total;}; int main( void ){ int n,i,totals(0),max(0); cin >> n; struct Student* team = new Student[n],* tmax ; FOR(i,0,n) { cin >> team[i].name >> team[i].m1 >> team[i].m2 >> team[i].c1 >> team[i].c2 >> team[i].p; team[i].total = 0; } FOR(i,0,n) { if (team[i].m1 > 80 && team[i].p > 0) team[i].total += 800; if (team[i].m1 > 85 && team[i].m2 > 80) team[i].total += 400; if (team[i].m1 > 90) team[i].total += 200; if (team[i].m1 > 85 && team[i].c2 == 'Y') team[i].total += 100; if (team[i].m2 > 80 && team[i].c1 == 'Y') team[i].total += 85; totals += team[i].total; } max = team[0].total; tmax = &team[0]; FOR(i,1,n) if (team[i].total > max) {max = team[i].total ; tmax = &team[i]; } cout << tmax -> name << endl << tmax -> total << '0' << endl << totals << '0' << endl; totals = max = 0; delete [] team;}