Nyoj-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
ChenRuiyi900028700
Source

Noip2005


Reference code:

#include<stdio.h> #include<algorithm>using namespace std;struct STU{char name[21];int qimo;int piyi;char clas;char xb;int luw;int money;}stu[101];int main(){int N,x,i;scanf("%d",&N);while(N--){scanf("%d",&x);for(i=0;i<x;++i){scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].piyi,&stu[i].clas,&stu[i].xb,&stu[i].luw);stu[i].money=0;if(stu[i].qimo>80&&stu[i].luw!=0)stu[i].money+=8000;if(stu[i].qimo>85&&stu[i].piyi>80)stu[i].money+=4000;if(stu[i].qimo>90)stu[i].money+=2000;if(stu[i].xb=='Y'&&stu[i].qimo>85)stu[i].money+=1000;if(stu[i].clas=='Y'&&stu[i].piyi>80)stu[i].money+=850;    }   STU k=stu[0];   for(i=1;i<x;++i)   if(stu[i].money>k.money)   k=stu[i];   printf("%s\n%d\n",k.name,k.money);   int sum=0;   for(i=0;i<x;++i)   sum+=stu[i].money;   printf("%d\n",sum);}return 0;}

Nyoj-who received 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.