View Code of Problem 5

package com.zucc.acm;

import java.util.Scanner;

/**
 * @author 陈豪明-铁臂
 * @Description
 * @date 2019/3/4
 */
public class Problem5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("test");
        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            int n, m;
            n = scanner.nextInt();
            m = scanner.nextInt();
            int[][] temp = new int[n][2];
            for (int j = 0; j < n; j++) {
                temp[j][0] = scanner.nextInt();
                temp[j][1] = scanner.nextInt();
            }
            for (int j = 0; j < m; j++) {
                Problem5.select(temp);
                if (j!=m-1){
                    System.out.print(" ");
                }else {
                    System.out.println("");
                }
            }
        }
    }

    public static void select(int[][] values) {
        int max=0;
        for (int i = 1; i < values.length; i++) {
            if (values[i][0]>values[max][0]){
                max=i;
            }else if (values[i][0]==values[max][0]){
                if (values[i][1]>values[max][1]){
                    max=i;
                }
            }
        }
        values[max][0]=0;
        values[max][1]=0;
        System.out.print(max+1);
    }
}

/*
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
           ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
            ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
             ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
              ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
               ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                 ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                  ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                   ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                     ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                      ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                       ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                        ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                         ^
Main.java:6: error: unmappable character for encoding ASCII
 * @author ?????????-??????
                          ^
15 errors
*/

Double click to view unformatted code.


Back to problem 5