結果

問題 No.638 Sum of "not power of 2"
ユーザー natoriusannatoriusan
提出日時 2023-07-31 00:53:42
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 10,264 ms
コンパイル使用メモリ 183,620 KB
実行使用メモリ 37,084 KB
最終ジャッジ日時 2024-04-18 01:57:58
合計ジャッジ時間 12,817 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
30,208 KB
testcase_01 AC 62 ms
30,332 KB
testcase_02 AC 62 ms
30,336 KB
testcase_03 AC 62 ms
30,208 KB
testcase_04 AC 336 ms
34,048 KB
testcase_05 AC 63 ms
30,336 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 63 ms
30,568 KB
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (246 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/

ソースコード

diff #

open System

let n = stdin.ReadLine () |> int64

let rec is2 n =
    if n = 1L then
        true
    elif n % 2L = 0L 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)
0