結果

問題 No.1230 Hall_and_me
ユーザー rutilicus
提出日時 2020-09-19 21:34:08
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 14,043 ms
コンパイル使用メモリ 432,544 KB
実行使用メモリ 57,148 KB
最終ジャッジ日時 2024-06-23 19:09:36
合計ジャッジ時間 26,348 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:21:13: warning: 'appendln(Double): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(ans)
            ^

ソースコード

diff #

import kotlin.math.max

fun main() {
    val builder = StringBuilder()

    // モンティホール問題らしい
    val (p, q, r) = readInputLine().split(" ").map { it.toDouble() }

    val base = p + q + r

    var ans = 0.0

    // なんか違う気がする
    ans = max(ans, p / base)
    ans = max(ans, (q + r) / base)
    ans = max(ans, q / base)
    ans = max(ans, (p + r) / base)
    ans = max(ans, r / base)
    ans = max(ans, (p + q) / base)

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0