Who won the highest scholarship

Source: Internet
Author: User

/* The practice of describing a school is to grant scholarships after each semester's final exams. There are five scholarships issued, the conditions 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 Scholarships, 4000 yuan per person, The final average score is higher than 85 points (>85), and the class appraisal result is higher than 80 (&GT;80) students are available, 3) Merit Award, 2000 yuan per person, the end of the average score of more than 90 points (&GT;90) students are available; 4) Western Scholarship, 1000 yuan per person, Students from Western provinces with an average of 85 points at the end of the semester (&GT;85) are eligible, 5) class Contribution award, 850 yuan per person, and the student cadres with a class appraisal score higher than 80 (>80) can be obtained, as long as the eligibility criteria can be awarded, the number of winners of each scholarship is not limited, Each student can also receive a number of scholarships at the same time.   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). Enter the first line of input data N, representing the number of test data groups (0&LT;N&LT;100), the first line of each set of test data input is an integer X (1 <= X <= 100), representing 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. Sample Input 1 4 Yaolin 0 chenruiyi x n y 1 LiXin x n n 0 zhangqin, y N 1 Sample output Chenruiyi 9000 28700 *//*1 4 Yaolin 0 chenruiyi x 0 N y 1 LiXin x n n 1 zhangqin Chenruiyi 9000*/#include<stdio.h>#include<string.h>struct{    //name    Charname[ A]; //Average final result    intQimo; //Class Appraisal Results    intBanyi; //whether it is a student cadre    CharBangan; //whether it is a western province student    CharXibu; //number of papers published    intLunwen; //Bonuses    intJiangjin; }data[ the];intMainintargcConst Char*argv[]) {    //Insert code here ...    intn,x; inti,tsum,t,k=0; scanf ("%d",&N);  while(n--) {scanf ("%d",&x);  for(i=0; i<x;i++) Data[i].jiangjin=0;  for(i=0; i<x;i++) scanf ("%s%d%d%c%c%d",data[i].name,&data[i].qimo,&data[i].banyi,&data[i].bangan,&data[i].xibu,&Data[i].lunwen);  for(i=0; i<x;i++)        {            if(data[i].qimo> the&&data[i].lunwen>=1) Data[i].jiangjin+=8000; if(data[i].qimo> -&&data[i].banyi> the) Data[i].jiangjin+=4000; if(data[i].qimo> -) Data[i].jiangjin+= -; if(data[i].qimo> -&&data[i].xibu=='Y') Data[i].jiangjin+= +; if(data[i].banyi> the&&data[i].bangan=='Y') Data[i].jiangjin+=850; } t=-1; Tsum=0;  for(i=0; i<x;i++) {Tsum+=Data[i].jiangjin; if(t<Data[i].jiangjin) {T=Data[i].jiangjin; K=i; }} printf ("%s\n%d\n%d\n", data[k].name,data[k].jiangjin,tsum); }    return 0;}

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.