結果
| 問題 |
No.237 作図可能性
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-05 00:31:50 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 363 ms / 2,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 13,764 ms |
| コンパイル使用メモリ | 198,188 KB |
| 実行使用メモリ | 35,792 KB |
| 最終ジャッジ日時 | 2024-11-16 18:55:24 |
| 合計ジャッジ時間 | 25,876 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (650 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 inline pow b e =
let rec iter e acc =
match e with
| i when i = LanguagePrimitives.GenericZero -> acc
| _ -> iter (e - LanguagePrimitives.GenericOne) (acc * b)
iter e LanguagePrimitives.GenericOne
let rec product lst =
match lst with
| [] -> Seq.singleton []
| x::xs -> Seq.collect (fun y -> product xs |> Seq.map (fun z -> y::z)) x
let count n =
List.replicate 5 [0L;1L]
|> product
|> Seq.map (fun e ->
Seq.zip [3L;5L;17L;257L;65537L] e
|> Seq.map (fun e -> pow (fst e) (snd e))
|> Seq.reduce (*))
|> Seq.filter (fun e -> e <> 1L && e <= 1000000000L)
|> Seq.append [4L]
|> Seq.map (fun i ->
Seq.initInfinite (fun e -> pow 2L e)
|> Seq.takeWhile (fun e -> i * e <= n)
|> Seq.length)
|> Seq.sum
stdin.ReadLine () |> int64 |> count |> printfn "%d"