結果

問題 No.1129 Rating じゃんけん
ユーザー バカらっく
提出日時 2022-02-03 13:56:39
言語 Kotlin
(2.3.10)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 616 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,975 ms
コンパイル使用メモリ 451,364 KB
実行使用メモリ 59,000 KB
最終ジャッジ日時 2026-03-04 11:43:53
合計ジャッジ時間 13,158 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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