P4325题目要求
P4325题目链接
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static int arraycount(int [] a) {
//计算一维数组的长度
int n = a.length;
//将数组拷贝到新的地址,这样对新数组操作不会改变原数组
int [] tmp = new int [n];
System.arraycopy(a, 0, tmp, 0, n);
//统计元素种类数
int Num = 1;
//将数组按元素大小重新排序
Arrays.sort(tmp);
for(int i = 1; i
关注
打赏
热门博文
- 【Linux】Ubuntu20.04安装和卸载MySQL8
- 【Linux】Ubuntu 20.04 报错 curl: (23) Failure writing output to destination 的解决方法
- 【Java】JUnit 4.13.2 警告 ‘assertEquals(double, double)‘ is deprecated 的解决方法
- 【JavaScript】处理 @parcel/transformer-js: Browser scripts cannot have imports or exports.
- 【Python】处理TypeError: Plain typing.NoReturn is not valid as type argument
- 【Python】Matplotlib可视化50例
- 【C语言】C语言修改MySQL数据库
- 【Java】从默认包导入类和对象报错的解决方法
- 【Java】panel.getGraphics()报错空指针异常的解决方法
- 【Java】IDEA编译Java项目报错 java: 找不到符号 的解决方法