Who received the highest Scholarship

Source: Internet
Author: User
Who received the maximum scholarship time limit: 1000 MS | memory limit: 65535 kb difficulty: 2
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
Input data N in the first line, indicating the number of test data groups (0 <n <100 ), the first row of test data is an integer x (1 <= x <= 100), indicating the total number of students. The next row in row X contains the data of a student. The data is name, average score at the end of the period, class evaluation score, whether it is a student cadre, or a student from a Western Province, 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 of each group of test data 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 that the student receives. 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 X students.
Sample Input
14YaoLin 87 82 Y N 0ChenRuiyi 88 78 N Y 1LiXin 92 88 N N 0ZhangQin 83 87 Y N 1
Sample output
Chenruiyi
9000
28700

 

 

 

<PRE class = "CPP" name = "code"> # include <iostream> # include <stdio. h> # include <string. h> using namespace STD; int main () {int I, j, n, m, PJ, Py, T, S, Max, sum; char GB, XB; string name1, name; scanf ("% d", & M); getchar (); for (I = 0; I <m; I ++) {scanf ("% d ", & N); max = 0; sum = 0; For (j = 0; j <n; j ++) {getchar (); s = 0; CIN> name; // scanf ("% s", & N); scanf ("% d % C % d", & PJ, & py, & GB, & XB, & T); If (pj> 80 & T> = 1) S + = 8000; If (pj> 85 & py> 80) S + = 4000; if (pj> 90) S + = 2000; If (pj> 85 & XB = 'y') S + = 1000; if (PY> 80 & GB = 'y') S + = 850; If (S> MAX) {max = s; name1 = Name ;} sum + = s;} cout <name1 <Endl; // printf ("% s \ n", name1) cannot be used here; printf ("% d \ n ", max); printf ("% d \ n", sum);} return 0 ;}

 


// C Language

#include<stdio.h>#include<string.h>int main(){int i,j,n,m,pj,py,t,s,max,sum;char gb,xb;char name1[20],name[20]; scanf("%d",&m);getchar();for(i=0;i<m;i++){scanf("%d",&n);    max=0;sum=0;for(j=0;j<n;j++){getchar();s=0;scanf("%s",&name);scanf("%d %d %c %c %d",&pj,&py,&gb,&xb,&t);if(pj>80&&t>=1)s+=8000;if(pj>85&&py>80)s+=4000;if(pj>90)s+=2000;if(pj>85&&xb=='Y')s+=1000;if(py>80&&gb=='Y')s+=850;if(s>max){max=s;strcpy(name1,name);}sum+=s;}printf("%s\n",name1);printf("%d\n",max);printf("%d\n",sum);}return 0;}


 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.