解题思路:
注意事项:
参考代码:
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语言训练-字符串正反连接 (C语言代码)浏览:622 |
字符串对比 (C语言代码)浏览:1415 |
字符串比较 (C语言代码)答案错误????浏览:602 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:522 |
用筛法求之N内的素数。 (C语言代码)浏览:659 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:578 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1436 |
最小公倍数 (C语言代码)浏览:1033 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:787 |
字符逆序 (C语言代码)浏览:460 |