解题思路:
注意事项:
参考代码:
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { 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分
1 人评分
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:567 |
成绩转换 (C语言代码)浏览:1005 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:704 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1140 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:661 |
哥德巴赫曾猜测 (C语言代码)浏览:2320 |
1017题解浏览:595 |
循环入门练习6 (C语言代码)浏览:956 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:324 |
C二级辅导-等差数列 (C语言代码)浏览:810 |