結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
![]() |
提出日時 | 2017-12-03 16:16:41 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 352 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 12,041 ms |
コンパイル使用メモリ | 430,928 KB |
実行使用メモリ | 55,372 KB |
最終ジャッジ日時 | 2024-11-20 13:24:10 |
合計ジャッジ時間 | 20,680 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
コンパイルメッセージ
Main.kt:27:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
import java.util.Scannerdata class Count(var eastCount: Int, var westCount: Int)class No486() {val input = Scanner(System. `in`).next()val count = Count(0, 0)fun victoryOrDefeat(): Count {run breaker@ {input.forEach {if (it == 'O') {count.eastCount++count.westCount = 0} else {count.westCount++count.eastCount = 0}if(count.eastCount == 3 || count.westCount == 3) return@breaker}}return count}}fun main(args: Array<String>) {val no486 = No486().victoryOrDefeat()var winner = if (no486.eastCount > no486.westCount) "East" else "West"if (no486.eastCount < 3 && no486.westCount < 3) winner = "NA"println(winner)}