結果

問題 No.1129 Rating じゃんけん
ユーザー バカらっくバカらっく
提出日時 2022-02-03 13:56:39
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 11,427 ms
コンパイル使用メモリ 423,340 KB
実行使用メモリ 53,112 KB
最終ジャッジ日時 2023-09-02 03:15:06
合計ジャッジ時間 18,607 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 288 ms
52,856 KB
testcase_01 AC 287 ms
52,716 KB
testcase_02 AC 279 ms
52,828 KB
testcase_03 AC 280 ms
52,896 KB
testcase_04 AC 283 ms
53,092 KB
testcase_05 AC 288 ms
52,832 KB
testcase_06 AC 283 ms
52,908 KB
testcase_07 AC 286 ms
53,112 KB
testcase_08 AC 285 ms
52,668 KB
testcase_09 AC 282 ms
52,676 KB
testcase_10 AC 289 ms
52,780 KB
testcase_11 AC 281 ms
52,824 KB
testcase_12 AC 286 ms
52,832 KB
testcase_13 AC 287 ms
52,940 KB
testcase_14 AC 284 ms
52,856 KB
testcase_15 AC 280 ms
52,712 KB
testcase_16 AC 279 ms
52,808 KB
testcase_17 AC 285 ms
52,892 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    val (a,b,c,d) = readLine()!!.split(" ").map { it.toInt() }
    val p1 = Player(a,b)
    val p2 = Player(c,d)
    val ans = if(p1.isDraw(p2)) {
        "Draw"
    } else if(p1.isWin(p2)) {
        "null"
    } else {
        "tRue"
    }
    println(ans)
}

class Player(val rating:Int, val hand:Int) {
    fun isDraw(other:Player):Boolean {
        return rating == other.rating && hand == other.hand
    }
    fun isWin(other:Player):Boolean {
        if(rating == other.rating) {
            return (hand+1)%3 == other.hand
        }
        return rating > other.rating
    }
}
0