HDACM 1031
import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);while(sc.hasNext()){int n = sc.nextInt();int m = sc.nextInt();int k = sc.nextInt();double nm[][] = new double[n+1][m];//多new一行用来存放对第j个元素的总满意度for (int i = 0; i < n; i++) {for (int j = 0; j < m; j++) {nm[i][j]= sc.nextDouble();}}for (int i = 0; i < m; i++) {for (int j = 0; j < n; j++) {nm[n][i] += nm[j][i];}}boolean isUsed[] = new boolean[m];//用来表示k个中的某一个元素是否已经选出来了for (int i = 0; i < k; i++) {double max = 0;int index = 0;boolean isFirst = true;for (int j = 0; j < m; j++) {if (!isUsed[j]) {if (isFirst) {max = nm[n][j];index = j;isUsed[index] = true;isFirst = false;}else{if (max<nm[n][j]) {max = nm[n][j];isUsed[index] = false;isUsed[j]=true;index = j;}}}}}boolean isFirst = true;for (int i = m-1; i >=0; i--) {if (isUsed[i]) {if (isFirst) {System.out.print(i+1);isFirst = false;}else{System.out.print(" "+(i+1));}}}System.out.println();}sc.close();}
}