输入包括两行,第一行包括一个整数n(1 ≤ n ≤ 50),即玩家的人数 第二行n个整数x[i](0 ≤ x[i] ≤ 100000),即每个玩家写下的整数。输出描述:
输出一个整数,表示赢得游戏的那个玩家获得的最大数字是多少。输入
3 9638 8210 331输出
3689
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import
java.util.Arrays;
import
java.util.Scanner;
public
class
Main {
public
static
void
main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner =
new
Scanner(System.in);
int
n = scanner.nextInt();
int
max = -
1
;
for
(
int
i =
0
; i != n; i++){
String s = scanner.next();
char
temp[] = s.toCharArray();
max = Math.max(max, hebing(temp));
}
System.out.print(max);
}
public
static
int
hebing(
char
a[]){
Arrays.sort(a);
int
temp1 = Integer.parseInt(
new
String(a));
return
temp1;
}
}