본문 바로가기
JAVA/SWEA

[D1] 2068. 최대수 구하기

by ♡˖GYURI˖♡ 2023. 11. 18.

1, 2, 3이라는 숫자가 출력되어야 하는데 0, 1, 2로 출력되어 fail이 떴던 문제...

 

import java.util.*;
class Solution {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int i = 1; i <= T; i++) {
		    int[] n = new int[10];
		    for(int j = 0; j < 10; j++) {
		        n[j] = sc.nextInt();
		    }
		    Arrays.sort(n);
		    System.out.println("#" + i + " " + n[9]);
		}
	}
}

'JAVA > SWEA' 카테고리의 다른 글

[D1] 2072. 홀수만 더하기  (0) 2023.11.18
[D1] 1933. 간단한 N 의 약수  (0) 2023.11.18
[D1] 2027. 대각선 출력하기  (0) 2023.11.18
[D1] 1936. 1대1 가위바위보  (0) 2023.11.18
[D1] 2058. 자릿수 더하기  (0) 2023.11.18