⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯

这个java程序设计题目怎么写,求源码⋯⋯⋯⋯⋯⋯⋯⋯
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- threenewbee 2016-05-26 07:40关注
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner in = new Scanner(System.in); int n = in.nextInt(); int[][] data = new int[n][]; int[] result = new int[n]; for (int i = 0; i < n; i++) { int m = in.nextInt(); data[i] = new int[m]; int o = 0; for (int j = 0; j < m; j++) { int l = in.nextInt(); Boolean b = false; for (int k : data[i]) if (k == l) b = true; if (!b) data[i][o++] = l; } Arrays.sort(data[i]); result[i] = data[i][data[i].length - in.nextInt()]; } for (int item : result) System.out.println(item); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报