题目
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();int m = sc.nextInt();int[][] a = new int[n][2];for(int i=0;i<n;i++) {a[i][0] = i+1;String s = a[i][0]+"";for(int j=0;j<s.length();j++) {a[i][1] += s.charAt(j)-'0';}}
// Arrays.sort(a,(o1,o2)->o1[1]==o2[1]?o1[0]-o2[0]:o1[1]-o2[1]);Arrays.sort(a,new Comparator<int[]>() {@Overridepublic int compare(int[] o1, int[] o2) {if(o1[1]!=o2[1])return o1[1]-o2[1];return o1[0]-o2[0];}});
// for(int i=0;i<n;i++)
// System.out.println(a[i][0]+" "+a[i][1]);System.out.println(a[m-1][0]);}
}