解题思路:
注意事项:
参考代码:import java.util.Scanner;
public class The2909Test {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a1 = new int[n];
for (int i = 0; i <a1.length ; i++) {
a1[i] = in.nextInt();
}
int max1 = -1;
for (int i = 0; i <a1.length ; i++) {
if(a1[i]>max1){
max1 = a1[i];
}
}
//System.out.println(max1);
int temp = 0;
for (int i = 0; i < a1.length; i++) {
if(a1[i] == max1){
temp=i;
break;
}
}
//System.out.println(temp);
int[] count = new int[max1+1];
for(int i=0;i<=max1;i++){
for(int j =0;j<a1.length;j++){
if(a1[j]<=max1){
if(i==a1[j]){
count[i]++;
}
}
}
}
for (int i = 0; i <count.length ; i++) {
//System.out.println(i + " :"+count[i]);
System.out.println(count[i]);
}
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:584 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:774 |
简单的a+b (C语言代码)浏览:340 |
校门外的树 (C语言代码)浏览:700 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:885 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:558 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:956 |
1052题解(链表操作)浏览:674 |
最好的,浏览:563 |
盐水的故事 (C语言代码)浏览:1528 |