結果
| 問題 |
No.88 次はどっちだ
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-07-31 01:18:59 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 5,000 ms |
| コード長 | 980 bytes |
| コンパイル時間 | 10,094 ms |
| コンパイル使用メモリ | 197,228 KB |
| 実行使用メモリ | 31,360 KB |
| 最終ジャッジ日時 | 2024-09-15 08:35:33 |
| 合計ジャッジ時間 | 10,252 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (426 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let R() = stdin.ReadLine()
type Turn = FstPlayer | SndPlayer
let (|Oda|Yukiko|) = function | x when x = "oda" -> Oda | _ -> Yukiko
let (|Odd|Eve|) n = match n % 2 with | 1 -> Odd | _ -> Eve
let playerName fstMove (turn:Turn) =
match fstMove, turn with
| Oda, FstPlayer
| Yukiko, SndPlayer
-> "oda"
| _ -> "yukiko"
let judge (board:string[]) =
let charaDist=
board
|> Array.map(fun x -> x.ToCharArray())
|> Array.concat
|> Array.countBy(fun x -> x)
|> Map.ofArray
let blackNum = charaDist |> Map.find 'b'
let whiteNum = charaDist |> Map.find 'w'
match abs(blackNum - whiteNum) with
| Eve -> Turn.FstPlayer
| Odd -> Turn.SndPlayer
[<EntryPoint>]
let main _ =
let GRID_NUM = 8
let S = R()
let B = Array.init GRID_NUM (fun _ -> R())
judge B
|> function
| FstPlayer as t -> playerName S t
| SndPlayer as t -> playerName S t
|> printfn "%s"
0
tak