P1002 who took the most scholarships

Source: Internet
Author: User

P1002 who took the most scholarships

Time : 1000ms/ space : 131072kib/java class name : Main

Background

NOIP2005 the first problem of the improvement group

Describe

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, each 8000 yuan, the end of the average score is higher than the Year (>80), and published in this semester 1 article or 1 students with more than one article can be obtained;

2) May Fourth scholarships per person 4000 yuan, the end of the average score is higher than the score (>85), and the class appraisal result is higher than the points ( >80 ) can be obtained by students;

3) Outstanding Achievement Award, each per capita , the end of the average score is higher than the score (>90 ) can be obtained by students;

4) Western Scholarship, each per person , isavailable to students in the western provinces where the end-of- term average is higher than (>85);

5) Class Contribution award, each 850 Yuan, the class appraisal result is higher than the grade (>80) student cadre can obtain;

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 was a total of May Fourth scholarships and a class contribution award, while he was a student cadre at the end of the year, and he was able to earn 4850 of the prize. 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 format

The first line of input is an integerN(1 <= N <=), which indicates the total number of students. The nextNrow per row is a student's data, from left to right in turn is the name, the end of the average score, the class appraisal results, whether the student cadres, is the West Province students, as well as the number of papers published. Names are made up of letters of the same size, not more than -string (without spaces), and the end-of-term average and class appraisal results are0to the -an integer between (including0and the -whether it is a student cadre and whether the students in the western provinces are represented by a single character,YSay yes,Nthe number of papers published is0to theTenthe integer (including0and theTen). Each of the two adjacent data items is separated by a space.

Output format

The output includes three lines, 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 N students.

Test Sample 1

Input

4

Yaolin, 0, Y N

Chenruiyi N Y 1

LiXin N N 0

Zhangqin, Y N 1

Output

Chenruiyi

9000

28700

--------------------------------

Evaluation Status Accepted

Topic P1002 who took the most scholarships

Submission Time 2016-03-27 14:09:14

Code language Java

Consumption time 1651 MS

Consumes memory 14512 KiB

Construct a student class ~

----------------------------------

 class   student {String name;    String scores;    String test;    String cadre;    String West;    String article;  public   student (String name,string Scores,string test,string cadre,string west,string article) { name;         this . Scores=scores;         this . Test=test;         this . Cadre=cadre;         this . West=west;     this . Article=article; }}
ImportJava.util.Scanner; Public classMain {Static intN; Staticstudent [] Stu;  Public Static voidMain (string[] args) {//TODO auto-generated Method StubScanner sc=NewScanner (system.in);  while(Sc.hasnext ()) {n=Sc.nextint (); Stu=NewStudent[n+1];            String name;            String scores;            String test;            String cadre;            String West;            String article; intallnum=0;intK=0; intmax=-100;  for(inti=0;i<n;i++){                intMoney=0; Name=Sc.next (); Scores=Sc.next (); Test=Sc.next (); Cadre=Sc.next (); West=Sc.next (); Article=Sc.next (); if(Integer.parseint (scores) >80 &&integer.parseint (article) >0) Money+=8000; if(Integer.parseint (scores) >85&& integer.parseint (test) >80) Money+=4000; if(Integer.parseint (scores) >90) Money+=2000; if(West.equals ("Y") && Integer.parseint (scores) >85) Money+=1000; if(Integer.parseint (test) >80&& cadre.equals ("Y")) money+=850; Allnum+=Money ; if(Money>max) {k=i;max=Money ;} Stu[i]=Newstudent (name,scores,test,cadre,west,article); } System.out.println (Stu[k].name+ "\ n" +max+ "\ n" +allnum);    } sc.close (); }}

P1002 who took the most scholarships

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.