• Home
  • About
    • Moon photo

      Moon

      개발자는 자고 싶다.

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • Posts
    • All Posts
    • All Tags
  • Projects

백준 - 2562 최댓값

07 Jun 2022

Reading time ~1 minute

문제

2562 최댓값

screencapture

답

kotlin code

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)
}


baekjoonkotlin코틀린백준브론즈구현 Share Tweet +1