結果
| 問題 |
No.415 ぴょん
|
| ユーザー |
|
| 提出日時 | 2016-09-05 23:05:20 |
| 言語 | OCaml (5.2.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 759 bytes |
| コンパイル時間 | 1,628 ms |
| コンパイル使用メモリ | 26,472 KB |
| 実行使用メモリ | 151,076 KB |
| 最終ジャッジ日時 | 2025-02-07 08:48:27 |
| 合計ジャッジ時間 | 22,231 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 TLE * 10 |
ソースコード
open Big_int_Z
module BISet = Set.Make(
struct
let compare = compare_big_int
type t = big_int
end )
let ( +! ) = add_big_int
let ( %! ) = mod_big_int
let () =
let arr = Array.make 2 zero_big_int in
Scanf.scanf "%s %s\n" (fun n d -> arr.(0) <- big_int_of_string n; arr.(1) <- big_int_of_string d);
let n, d = arr.(0), arr.(1) in
let rec count_pyon pos hist count =
let next_pos, next_hist = (pos +! d) %! n, BISet.add pos hist in
if BISet.mem next_pos next_hist then string_of_big_int count
else
let next_count = count +! unit_big_int in
count_pyon next_pos next_hist next_count
in
count_pyon zero_big_int BISet.empty zero_big_int |>
Printf.printf "%s\n"