結果

問題 No.638 Sum of "not power of 2"
ユーザー natoriusannatoriusan
提出日時 2023-07-31 00:54:17
言語 F#
(F# 4.0)
結果
AC  
実行時間 330 ms / 1,000 ms
コード長 380 bytes
コンパイル時間 6,966 ms
コンパイル使用メモリ 191,064 KB
実行使用メモリ 34,628 KB
最終ジャッジ日時 2024-04-18 01:59:10
合計ジャッジ時間 9,799 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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