Who won the highest scholarship

Source: Internet
Author: User

Title Description:
the practice of a school is to grant scholarships after the final exams of each semester. There are five scholarships issued, and the conditions for obtaining them are different:
1) Academician scholarship, 8000 yuan per person, the end of the average score of more than 80 points (>80), and in this semester published 1 or more than 1 papers students can be obtained;
2) May Fourth Scholarship, 4000 yuan per person, the end of the average score is higher than 85 points (>85), and the class appraisal result is higher than 80 (>80) students can be obtained;
3) Outstanding Achievement Award, 2000 yuan per person, students who have a final average score above 90 (>90) can be obtained;
4) Western Scholarship, 1000 yuan per person, and students from western provinces with a final average score above 85 (>85);
5) Class Contribution award, 850 yuan per person, the class appraisal result is higher than 80 points (>80) student cadres can be obtained;
As long as the criteria are met, there is no limit to the number of winners for each scholarship, and a number of scholarships are available for each student. For example, Yiao Lin's end-of-term average is 87 points, Class review score 82 points, and he is a student cadre, then he can also receive May Fourth Scholarship and Class contribution award, the total bonus is 4850 yuan. Now give the relevant data for several students, please calculate which students get the highest total bonus (assuming that the students can meet the conditions for the scholarship).
 

Input:

the first line enters data N, which represents the number of test data groups (0<N<100), and the first line of each set of test data inputs is an integer X (1 <= x <= 100) that represents the total number of students. The next X row is a student's data, from left to right, in turn, the name, the final average, the class appraisal, whether the student cadre, the western Province students, and the number of papers published. The name is a string of not more than 20 of the length of the letter in the case of uppercase and lowercase letters (without spaces); The final average and class review scores are integers between 0 and 100 (including 0 and 100), whether student cadres and Western provinces students are represented by a single character, y means yes, n means not The number of papers published is 0 to 10 integers (including 0 and 10). Each of the two adjacent data items is separated by a space.
Output:
Each set of test data output consists of three rows, the first row is the name of the student who received the most bonus, and the second line is the total number of bonuses that the student received. If there are two or two students who receive the most bonuses, the first student's name appears in the input file. The third line is the total number of scholarships received by these X students.

output:
Each set of test data output consists of three rows, the first row is the name of the student who received the most bonus, and the second line is the total number of bonuses that the student received. If there are two or two students who receive the most bonuses, the first student's name appears in the input file. The third line is the total number of scholarships received by these X students.
Sample Input:
1
4
Yaolin, 0, Y N
Chenruiyi N Y 1
LiXin N N 0
Zhangqin, Y N 1
Sample output:
Chenruiyi
9000

28700

The code is as follows:

<span style= "FONT-SIZE:18PX;"         > #include <stdio.h>struct student{char a[21];              Student name int B;              final result int C;           Class appraisal result char k,t;              Whether K is a class cadre, t whether the Western student int z;        Number of papers published int award;   Bonus};int Main () {int tol=0;    Tol for the total bonus awarded int m=-1;    int i,j,w,m;    Student stu[101];    scanf ("%d", &i);        while (i--) {scanf ("%d", &j);     for (w=0;w<j;w++) {stu[w].award=0; Set the initial bonus for each student to 0} for (w=0;w<j;w++)//Enter the situation of each classmate scanf ("%s%d%d%c%c%d", Stu[w].a,&stu [w].b,&stu[w].c,&stu[w].k,&stu[w].t,&stu[w].z);//* Be sure to consider the problem of entering character space-time lattice here for (w=0;w<j;w++)//Get            The conditions of the various bonuses {if (stu[w].b>80&&stu[w].z>0) stu[w].award+=8000;            if (stu[w].b>85&&stu[w].c>80) stu[w].award+=4000;  if (stu[w].b>90) stu[w].award+=2000;          if (stu[w].b>85&&stu[w].t== ' Y ') stu[w].award+=1000;               if (stu[w].c>80&&stu[w].k== ' Y ') stu[w].award+=850;               printf ("%s%d\n", Stu[w].a,stu[w].award);      } for (w=0;w<j;w++) {tol+=stu[w].award; The total number of bonuses to be issued if (M<stu[w].award)//Bonus How much comparison {m=stu[w].                   Award;                    M=w;    Record Subscript}} printf ("%s\n%d\n%d", Stu[m].a,stu[m].award,tol); } return 0;} </span><span style= "FONT-SIZE:14PX;" ></span>
The results of the operation are as follows:



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Who won the highest scholarship

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.