結果

問題 No.312 置換処理
ユーザー taktak
提出日時 2018-04-21 18:51:13
言語 F#
(F# 4.0)
結果
AC  
実行時間 447 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 13,669 ms
コンパイル使用メモリ 184,520 KB
実行使用メモリ 35,220 KB
最終ジャッジ日時 2024-04-27 10:55:38
合計ジャッジ時間 20,750 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 293 ms
34,904 KB
testcase_01 AC 354 ms
34,968 KB
testcase_02 AC 447 ms
34,440 KB
testcase_03 AC 376 ms
35,220 KB
testcase_04 AC 292 ms
34,136 KB
testcase_05 AC 294 ms
34,372 KB
testcase_06 AC 309 ms
35,212 KB
testcase_07 AC 321 ms
35,216 KB
testcase_08 AC 294 ms
34,240 KB
testcase_09 AC 296 ms
34,524 KB
testcase_10 AC 301 ms
34,792 KB
testcase_11 AC 301 ms
35,084 KB
testcase_12 AC 297 ms
34,236 KB
testcase_13 AC 297 ms
34,248 KB
testcase_14 AC 295 ms
34,036 KB
testcase_15 AC 294 ms
34,368 KB
testcase_16 AC 300 ms
34,108 KB
testcase_17 AC 298 ms
34,540 KB
testcase_18 AC 294 ms
34,368 KB
testcase_19 AC 298 ms
34,800 KB
testcase_20 AC 295 ms
34,104 KB
testcase_21 AC 307 ms
34,248 KB
testcase_22 AC 290 ms
34,068 KB
testcase_23 AC 297 ms
34,980 KB
testcase_24 AC 298 ms
33,988 KB
testcase_25 AC 303 ms
34,656 KB
testcase_26 AC 296 ms
34,120 KB
testcase_27 AC 295 ms
33,856 KB
testcase_28 AC 294 ms
34,084 KB
testcase_29 AC 295 ms
34,668 KB
testcase_30 AC 306 ms
34,964 KB
testcase_31 AC 293 ms
34,904 KB
testcase_32 AC 307 ms
34,460 KB
testcase_33 AC 324 ms
35,100 KB
testcase_34 AC 323 ms
35,100 KB
testcase_35 AC 299 ms
34,412 KB
testcase_36 AC 296 ms
34,632 KB
testcase_37 AC 295 ms
34,804 KB
testcase_38 AC 296 ms
34,804 KB
testcase_39 AC 295 ms
34,076 KB
testcase_40 AC 296 ms
34,360 KB
testcase_41 AC 294 ms
34,804 KB
testcase_42 AC 297 ms
34,112 KB
testcase_43 AC 294 ms
34,152 KB
testcase_44 AC 305 ms
34,668 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (405 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 #

let minDivsor = function
    | 3L -> Some(3L)
    | 4L -> Some(4L)
    | n  ->
        seq{3L..n}
        |> Seq.takeWhile(fun x -> x*x<=n)
        |> Seq.where(fun x -> n%x=0L)
        |> Seq.tryHead

let n = stdin.ReadLine() |> int64

n
|> minDivsor
|> function
    | Some(x) -> x
    | None    ->
        match n%2L with
        | 0L -> n/2L
        | _  -> n
|> printfn "%i"
0