hiho week 86 register

Ended

Participants:360

Verdict:Accepted
Score:100 / 100
Submitted:2016-02-24 16:47:36

Lang:Java

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[][] prefer = new int[1001][1001];
            for (int i = 0i < ni++) {
                for (int j = 0j <= kj++) {
                    int place = in.nextInt();
                    prefer[i][place= j;
                }
            }
            int result = 0;
            for (int i = ki > 0i--) {//i
                int vote = 0;
                for (int j = 0j < nj++) {//j
                    if (prefer[j][i< prefer[j][result])
                        vote++;
                }
                if (vote > n / 2)
                    result = i;
            }
            if (result == 0) {
                System.out.println("otaku");
            } else {
                System.out.println(result);
            }
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX