解题思路:
注意事项:
参考代码:
Scanner sc=new Scanner(System.in);
int ns[]=new int[2];
ns[0]=sc.nextInt();
ns[1]=sc.nextInt();
ArrayList<Integer>list=new ArrayList<Integer>();
for (int i = 0; i < ns[0]; i++) {
int number=sc.nextInt();
if (number%ns[1]!=0) {
list.add(number);
}
}
Collections.sort(list);
for (int i = 0; i < list.size(); i++) {
if (list.get(i)>=65&&list.get(i)<=90) {
char ch=(char)(int)list.get(i);
System.out.print(ch+" ");
}
else {
System.out.print(list.get(i)+" ");
}
}
0.0分
4 人评分
C语言训练-大、小写问题 (C语言代码)浏览:2349 |
成绩转换 (C语言代码)浏览:1005 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:574 |
【明明的随机数】 (C语言代码)浏览:785 |
C语言训练-自由落体问题 (C语言代码)浏览:610 |
蚂蚁感冒 (C语言代码)浏览:1319 |
关于float,double变量的几点说明浏览:1810 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:530 |
C二级辅导-等差数列 (C语言代码)浏览:694 |
C二级辅导-同因查找 (C语言代码)浏览:563 |