解题思路:
注意事项:
参考代码:
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.6 (C++代码)浏览:738 |
拆分位数 (C++代码)用char简单粗暴,嗯浏览:1087 |
校门外的树 (C语言代码)浏览:717 |
C语言训练-计算1~N之间所有奇数之和 (C语言代码)浏览:655 |
买不到的数目 (C++代码)浏览:868 |
P1001 (C语言代码)浏览:801 |
简单的a+b (C语言代码)浏览:695 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:514 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:834 |
三角形 (C语言代码)浏览:915 |