Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Exam {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int N = sc.nextInt(); //amount of players
- int R = sc.nextInt(); //amount of rounds
- int[] sum = new int[N];
- int[] worstRank = new int[N];
- for (int i=0; i<R; i++) { //repeat round
- for (int j=0; j<N; j++) { //using j to repeat players
- sum[j]+=sc.nextInt();
- }
- //finished sum
- //find out the rank
- for (int j=0; j<N; j++) {//find out player j's rank
- //each player compare with every player
- int rank = 1;
- for (int k=0; k<N; k++) {
- if (sum[j]<sum[k]) { //j is you k is other
- rank++;
- }
- }
- if (worstRank[j]<rank) {
- worstRank[j] = rank;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement