結果
| 問題 |
No.638 Sum of "not power of 2"
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-31 00:54:17 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 342 ms / 1,000 ms |
| コード長 | 380 bytes |
| コンパイル時間 | 11,883 ms |
| コンパイル使用メモリ | 184,820 KB |
| 実行使用メモリ | 34,632 KB |
| 最終ジャッジ日時 | 2024-10-09 19:41:00 |
| 合計ジャッジ時間 | 15,828 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (314 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 = 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)