-
[java]백준 최댓값 2562번알고리즘 문제풀이/백준(자바) 2023. 4. 10. 23:07
코드
import java.util.Scanner; public class BOJ_2562 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] num = {in.nextInt(),in.nextInt(),in.nextInt(), in.nextInt(),in.nextInt(),in.nextInt(), in.nextInt(),in.nextInt(),in.nextInt()}; in.close(); int m=0;//max값 int s=0;//칸수 for(int i=0; i<9; i++){ if(num[i]>m){ m=num[i]; s=i+1; } } System.out.println(m+"\n"+s); } }
링크
https://www.acmicpc.net/problem/2562
'알고리즘 문제풀이 > 백준(자바)' 카테고리의 다른 글
[java]백준 수 정렬하기 2750번 (0) 2023.04.11 [java]백준 영수증 25304번 (0) 2023.04.10 [java]백준 코딩은 체육과목 입니다 25314번 (0) 2023.04.09 [java]백준 별 찍기 - 2 2439번 (0) 2023.04.08 [java]백준 별 찍기 - 1 2438번 (0) 2023.04.07