백준 - 2562 최댓값
문제
2562 최댓값
답
kotlin code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.*
import kotlin.collections.ArrayList
fun main(args: Array<String>) {
q2562();
}
fun q2562() = with(Scanner(System.`in`)) {
val requests = Array<Int>(9) {nextInt()};
val max = requests.maxOf { it };
val maxIndex = requests.indexOf(max);
println(max)
println(maxIndex + 1)
}
This post is licensed under CC BY 4.0 by the author.