package com.edu.hhxy;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
/**
* @author five-five
* @created 2021/10/13-21:07
*/
public class Demo07 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
List<Integer> j = new ArrayList<>();
List<Integer> o = new ArrayList<>();
int a = 10;
while (a-- > 0) {
int num = scanner.nextInt();
if (num % 2 == 0) {
o.add(num);
} else {
j.add(num);
}
}
j.sort(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2 - o1;
}
});
o.sort(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1 - o2;
}
});
StringBuilder stringBuilder = new StringBuilder();
for (Integer integer : j) {
stringBuilder.append(integer).append(" ");
}
for (Integer integer : o) {
stringBuilder.append(integer).append(" ");
}
System.out.println(stringBuilder.substring(0, stringBuilder.length() - 1).toString());
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:1072 |
模拟计算器 (C语言代码)浏览:892 |
高精度加法 (C++代码)(大数加法)浏览:934 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:611 |
字符逆序 (C语言代码)浏览:646 |
C语言程序设计教程(第三版)课后习题12.2 (C语言代码)浏览:767 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:508 |
上车人数 (C语言代码)浏览:713 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:668 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:393 |