結果
問題 |
No.548 国士無双
|
ユーザー |
|
提出日時 | 2020-06-20 12:06:28 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 409 ms |
コンパイル使用メモリ | 21,704 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 01:29:35 |
合計ジャッジ時間 | 1,233 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
Scanf.scanf "%s" (fun s -> let a = Array.make 13 0 in String.iter (fun c -> let q = int_of_char c - 97 in a.(q) <- a.(q) + 1) s; let a = Array.mapi (fun i v -> v, i) a in Array.sort compare a; if fst a.(12) > 2 || fst a.(11) > 1 then print_endline "Impossible" else if fst a.(0) = 1 then ( String.iter (fun c -> Printf.printf "%c\n" c) "abcdefghijklm" ) else Printf.printf "%c\n" "abcdefghijklm".[snd a.(0)] )