結果
| 問題 | No.638 Sum of "not power of 2" |
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-04-23 16:24:47 |
| 言語 | F# (F# 10.0) |
| 結果 |
AC
|
| 実行時間 | 216 ms / 1,000 ms |
| コード長 | 532 bytes |
| 記録 | |
| コンパイル時間 | 11,284 ms |
| コンパイル使用メモリ | 208,852 KB |
| 実行使用メモリ | 37,564 KB |
| 最終ジャッジ日時 | 2026-03-15 12:46:10 |
| 合計ジャッジ時間 | 7,834 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (198 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
let isEnable N =
let powOf2Set =
let powOf2Seq = Seq.unfold (fun x -> if x>(10.0**18.0|>int64) then None else Some(x,x*2L)) 1L
powOf2Seq |> Set.ofSeq
let lis = [3L .. (min (N-1L) 130L)]
lis |> List.tryFind(fun x ->
let y = N-x
not (powOf2Set.Contains x) && not (powOf2Set.Contains y))
let N = stdin.ReadLine() |> int64
N
|> isEnable
|> function
| None -> sprintf "-1"
| Some(x) -> sprintf "%i %i" x (N-x)
|> printfn "%s"
tak