# 排名

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 20727    Accepted Submission(s): 7689

Problem Description

Input

< 1000 )、考题数M ( 0 < M < = 10 )、分数线（正整数）G；第2行排序给出第1题至第M题的正整数分值；以下N行，每行给出一

（题目号由1到M）。

Output

Sample Input
4 5 25 10 10 12 13 15 CS004 3 5 1 3 CS003 5 2 4 1 3 5 CS002 2 1 2 CS001 3 2 3 5 1 2 40 10 30 CS001 1 2 2 3 20 10 10 10 CS000000000000000001 0 CS000000000000000002 2 1 2 0

Sample Output
3 CS003 60 CS001 37 CS004 37 0 1 CS000000000000000002 20
Hint
Huge input, scanf is recommended.

Source

import java.awt.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Scanner;

public class Main {

/**
* @param args
*/
public static class Student {
String num;
int n = 0;
int score = 0;
}

public static class ComparatorStudent implements Comparator{

@Override
public int compare(Object arg0, Object arg1) {
// TODO Auto-generated method stub
Student student1=(Student)arg0;
Student student2 = (Student)arg1;
int flag;
if(student1.score>student2.score){
flag=-1;
}else if(student1.score==student2.score){
flag =0;
}else{
flag=1;
}
if(flag==0){
return student1.num.compareTo(student2.num);
}else{
return flag;
}
}

}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
while (true) {
int N = in.nextInt();
if (N == 0) {
break;
}
int M = in.nextInt();
int avg = in.nextInt();
int[] eves = new int[M];
for (int i = 0;i<M;i++){
eves[i] = in.nextInt();
}
ArrayList<Student> L = new ArrayList<Student>();
while(N!=0){
N--;
Student stu = new Student();
stu.num = in.next();
stu.n = in.nextInt();
for (int i = 0;i<stu.n;i++){
int a =in.nextInt();
stu.score += eves[a-1];
}
}
int peo=0;
ComparatorStudent comparator = new ComparatorStudent();
Collections.sort(L,comparator);
for (Student student : L) {
if(student.score>=avg){
peo++;
}
}
System.out.println(peo);
for (Student student : L) {
if(student.score>=avg){
System.out.println(student.num+" "+student.score);
}
}
}
}
}

#### HDU 1236 排名（水~）

2015-08-30 11:47:38

#### hdu 杭电 1.3.1 1236 排名

2012-03-28 15:54:51

#### HDU 1236 排名（Java）

2018-03-14 19:35:39

#### 杭电ACM1236——排名

2015-05-03 11:06:55

#### hdu2093（考试排名）

2015-08-02 00:28:49

#### 排名（杭电oj1236）（简单排序）

2014-12-09 01:44:33

#### 杭电 HDU 1236 排名

2015-04-02 00:04:38

#### 排名(hdu 1236)

2015-08-18 09:31:02

#### hdu 1236 排名

2014-08-06 10:06:11

#### hdu 1236 排名（排序）

2011-10-05 11:42:21

## 不良信息举报

HDU　1236 排名 Java实现