728x90
Math.max()함수를 사용해 가장 높은 값을 출력했습니다.
import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
int T;
T=sc.nextInt();
for(int test_case = 1; test_case <= T; test_case++)
{
int n = 0;
for(int i=0; i<10; ++i){
n = Math.max(n, sc.nextInt());
}
System.out.printf("#%d %d%n", test_case, n);
}
}
}
'알고리즘' 카테고리의 다른 글
[Java] SWEA - 자릿수 더하기 (0) | 2023.01.12 |
---|---|
[Java] SWEA - 중간값 찾기 (0) | 2023.01.12 |
[Java] SWEA - 두 개의 숫자열 (0) | 2023.01.12 |
[Java] SWEA - Sum (0) | 2023.01.12 |
[Java] SWEA - 최빈수 구하기 (0) | 2023.01.12 |