結果
| 問題 |
No.638 Sum of "not power of 2"
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-31 00:53:06 |
| 言語 | F# (F# 4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 405 bytes |
| コンパイル時間 | 7,200 ms |
| コンパイル使用メモリ | 186,420 KB |
| 実行使用メモリ | 35,324 KB |
| 最終ジャッジ日時 | 2024-10-09 19:39:29 |
| 合計ジャッジ時間 | 11,313 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 6 WA * 6 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (259 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/
ソースコード
open System
let n = stdin.ReadLine () |> int64
let rec is2 n =
if n = 1L then
true
elif n % 2L = 0 then
is2 (n/2L)
else
false
if n < 8L then
if n = 6L then
3, n-3L
else
-1, 0L
else
printfn "%d" (n % 4L)
if is2 (n-3L) then
5, n-5L
else
3, n-3L
|> (fun (a, b) -> if a = -1 then printfn "-1" else printfn "%d %d" a b)