成绩排名——华为上机笔试题
2019-04-13 21:03发布
生成海报
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
ArrayList list = new ArrayList();
ArrayList mathlevel = new ArrayList();
ArrayList langlevel = new ArrayList();
ArrayList totallevel = new ArrayList();
while(sc.hasNext()){
String cmd = sc.nextLine();
String[] fen = cmd.split(":|,|;|=");
String name="";
int mathgrade=0,langgrade=0;
boolean flag = true;
for(int i = 0; i list){
int count = 0;
Collections.sort(list,new SortbyInt());
for(int i:list){
count++;
if(grade == i){
break;
}
}
return count;
}
}
class Person{
String name;
int mathgrade;
int langgrade;
public Person(String name, int mathgrade, int langgrade) {
this.name = name;
this.mathgrade = mathgrade;
this.langgrade = langgrade;
}
}
class SortbyInt implements Comparator{
@Override
public int compare(Object o1, Object o2) {
// TODO Auto-generated method stub
int i1 =(int)o1;
int i2 =(int)o2;
if(i1>i2){
return -1;
}
return 1;
}
}
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮