๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][2562][์ตœ๋Œ“๊ฐ’]

๋‰ด์ด NUEY 2023. 10. 15. 23:25
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

public class Main {
	// 2562	์ตœ๋Œ“๊ฐ’
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int max = 0;
		int maxIndex = 0;
		int[] numArr = new int[9];
		 
		for (int i=0; i<numArr.length; i++) { 
			numArr[i] = sc.nextInt();
			
			if (max < numArr[i]) {
				max = numArr[i];
				maxIndex = i+1;
			}
			
		}
		sc.close();
		
		System.out.println(max);
		System.out.println(maxIndex);
	}
}
๋ฐ˜์‘ํ˜•