結果
| 問題 |
No.642 Two Operations No.1
|
| コンテスト | |
| ユーザー |
tak
|
| 提出日時 | 2018-03-20 11:05:53 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 336 ms / 2,000 ms |
| コード長 | 324 bytes |
| コンパイル時間 | 15,288 ms |
| コンパイル使用メモリ | 184,560 KB |
| 実行使用メモリ | 34,732 KB |
| 最終ジャッジ日時 | 2024-06-23 10:51:56 |
| 合計ジャッジ時間 | 18,148 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (390 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 isOdd n = (n &&& 1) = 1
let op1 n = n+1
let op2 n = n/2
let N = Console.ReadLine() |> int
let rec f n cnt =
match n with
| 1 -> cnt
| x ->
if isOdd x then
f (op1 x) (cnt+1)
else
f (op2 x) (cnt+1)
f N 0
|> printfn "%i"
tak