
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int max = 0;
int count = 0;
int index = 0;
int[] arr = new int[9];
for (int i = 0; i < 9; i++) {
arr[i] = scanner.nextInt();
count++;
if (arr[i] > max) {
max = arr[i];
index = i+1;
}
}
System.out.println(max + "\n" + index);
}
}
'코딩 테스트 > Python - 백준 단계별로 풀어보기' 카테고리의 다른 글
백준 10813번 자바 - 공 바꾸기 (0) | 2024.04.30 |
---|---|
백준 10810번 자바 - 공 넣기 (0) | 2024.04.30 |
백준 10818번 자바 - 최소, 최대 (0) | 2024.04.30 |
백준 10871번 자바 - X보다 작은 수 (0) | 2024.04.28 |
백준 10807번 자바 - 개수 세기 (0) | 2024.04.15 |

import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int max = 0;
int count = 0;
int index = 0;
int[] arr = new int[9];
for (int i = 0; i < 9; i++) {
arr[i] = scanner.nextInt();
count++;
if (arr[i] > max) {
max = arr[i];
index = i+1;
}
}
System.out.println(max + "\n" + index);
}
}
'코딩 테스트 > Python - 백준 단계별로 풀어보기' 카테고리의 다른 글
백준 10813번 자바 - 공 바꾸기 (0) | 2024.04.30 |
---|---|
백준 10810번 자바 - 공 넣기 (0) | 2024.04.30 |
백준 10818번 자바 - 최소, 최대 (0) | 2024.04.30 |
백준 10871번 자바 - X보다 작은 수 (0) | 2024.04.28 |
백준 10807번 자바 - 개수 세기 (0) | 2024.04.15 |