結果
| 問題 |
No.638 Sum of "not power of 2"
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-04-23 16:23:13 |
| 言語 | F# (F# 4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 11,000 ms |
| コンパイル使用メモリ | 191,104 KB |
| 実行使用メモリ | 35,004 KB |
| 最終ジャッジ日時 | 2024-06-27 14:06:31 |
| 合計ジャッジ時間 | 11,854 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (297 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 isEnable N =
let powOf2Set =
let powOf2Seq = Seq.unfold (fun x -> if x>100000000L 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