package myPackage;
import java.util.*;
public class MyClass1 {
class Student{
String name;
int Chinese;
int Maths;
int Eng;
Student(String name,int Chinese,int Maths,int Eng){
this.name=name;
this.Chinese=Chinese;
this.Maths=Maths;
this.Eng=Eng;
}
}
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
MyClass1 m=new MyClass1();
Student[] s=new Student[n];
s[0]=m.new Student(in.next(),in.nextInt(),in.nextInt(),in.nextInt());
Student max=s[0];
for(int i=1;i<n;i++) {
s[i]=m.new Student(in.next(),in.nextInt(),in.nextInt(),in.nextInt());
if(s[i].Chinese+s[i].Maths+s[i].Eng>max.Chinese+max.Maths+max.Eng) {
max=s[i];
}
}
System.out.println(max.name+" "+max.Chinese+" "+max.Maths+" "+max.Eng);
}
}
【P5740 【深基7.例9】最厉害的学生】【Java】【内部类】
猜你喜欢
转载自blog.csdn.net/m0_57937908/article/details/120274980
今日推荐
周排行