結果
| 問題 |
No.1129 Rating じゃんけん
|
| ユーザー |
バカらっく
|
| 提出日時 | 2022-02-03 13:56:39 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 282 ms / 2,000 ms |
| コード長 | 616 bytes |
| コンパイル時間 | 10,064 ms |
| コンパイル使用メモリ | 439,512 KB |
| 実行使用メモリ | 51,856 KB |
| 最終ジャッジ日時 | 2024-06-11 09:53:21 |
| 合計ジャッジ時間 | 16,083 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
^
ソースコード
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
}
}
バカらっく