알고리즘
[Java] SWEA - 최대수 구하기
J3SUNG
2023. 1. 12. 21:07
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);
}
}
}