Written by
java-style
on
on
[알고리즘/백준] 2562 최댓값(자바)
[알고리즘/백준] 2562 최댓값(자바)
문제
https://www.acmicpc.net/problem/2562
풀이 코드
public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int max = Integer.MIN_VALUE; //최대값 int idx = Integer.MIN_VALUE; //최대값 위치 for (int i = 0; i < 9; i++) { int n = Integer.parseInt(br.readLine()); if (n > max) { idx = i; max = n; } } System.out.println(max); System.out.println(idx+1); } }
728x90
from http://developer-hm.tistory.com/146 by ccl(A) rewrite - 2021-09-18 22:01:55