結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-05-20 17:51:09 |
| 言語 | F# (F# 4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 647 bytes |
| コンパイル時間 | 11,805 ms |
| コンパイル使用メモリ | 190,336 KB |
| 実行使用メモリ | 37,196 KB |
| 最終ジャッジ日時 | 2024-06-28 14:44:12 |
| 合計ジャッジ時間 | 21,576 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 8 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (253 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 (|Turtle|Crane|) = function | 4 -> Turtle | _ -> Crane
let N = stdin.ReadLine() |> int
let a = stdin.ReadLine().Split() |> Array.map int
let cnts = a
|> Array.groupBy(fun x -> x)
|> Array.map(fun (k,_) -> k)
let gt,lt = (cnts |> Array.max,cnts |> Array.min)
if gt = lt then
match gt/(N-1) with
| Turtle -> (0,N)
| Crane -> (N,0)
else
cnts
|> Array.map(fun x -> x = gt)
|> (fun x ->
let crane = x
|> Array.where(fun x -> x)
|> Array.length
let turtle = N - crane
(crane,turtle))
|> (fun (c,t) -> printfn "%i %i" c t)
tak