結果

問題 No.889 素数!
ユーザー iwotiwot
提出日時 2020-06-19 18:26:24
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 3,711 ms
コンパイル使用メモリ 159,128 KB
実行使用メモリ 27,124 KB
最終ジャッジ日時 2023-09-16 13:00:49
合計ジャッジ時間 11,206 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
24,608 KB
testcase_01 AC 91 ms
25,024 KB
testcase_02 AC 77 ms
26,524 KB
testcase_03 AC 88 ms
27,048 KB
testcase_04 WA -
testcase_05 AC 77 ms
26,532 KB
testcase_06 AC 76 ms
26,572 KB
testcase_07 AC 77 ms
24,524 KB
testcase_08 AC 79 ms
24,612 KB
testcase_09 AC 79 ms
24,636 KB
testcase_10 AC 78 ms
24,524 KB
testcase_11 AC 76 ms
24,524 KB
testcase_12 AC 78 ms
24,548 KB
testcase_13 AC 92 ms
25,052 KB
testcase_14 AC 78 ms
26,596 KB
testcase_15 AC 91 ms
25,024 KB
testcase_16 AC 78 ms
24,784 KB
testcase_17 AC 91 ms
24,868 KB
testcase_18 AC 78 ms
24,548 KB
testcase_19 AC 92 ms
25,012 KB
testcase_20 AC 77 ms
24,544 KB
testcase_21 AC 92 ms
24,936 KB
testcase_22 AC 91 ms
25,040 KB
testcase_23 AC 93 ms
26,896 KB
testcase_24 AC 78 ms
26,756 KB
testcase_25 AC 89 ms
24,996 KB
testcase_26 AC 75 ms
24,604 KB
testcase_27 AC 90 ms
27,076 KB
testcase_28 AC 77 ms
24,724 KB
testcase_29 AC 79 ms
24,616 KB
testcase_30 AC 78 ms
26,720 KB
testcase_31 AC 92 ms
24,984 KB
testcase_32 AC 78 ms
24,592 KB
testcase_33 AC 93 ms
27,064 KB
testcase_34 AC 92 ms
25,064 KB
testcase_35 AC 92 ms
27,084 KB
testcase_36 AC 92 ms
27,076 KB
testcase_37 AC 77 ms
24,676 KB
testcase_38 AC 91 ms
25,064 KB
testcase_39 AC 91 ms
25,032 KB
testcase_40 AC 91 ms
24,920 KB
testcase_41 AC 79 ms
24,644 KB
testcase_42 AC 94 ms
26,972 KB
testcase_43 AC 78 ms
24,752 KB
testcase_44 AC 91 ms
27,032 KB
testcase_45 AC 90 ms
24,916 KB
testcase_46 AC 91 ms
24,944 KB
testcase_47 AC 77 ms
22,536 KB
testcase_48 AC 90 ms
24,980 KB
testcase_49 AC 77 ms
24,560 KB
testcase_50 AC 89 ms
25,040 KB
testcase_51 AC 90 ms
27,124 KB
testcase_52 AC 89 ms
27,104 KB
testcase_53 AC 77 ms
24,540 KB
testcase_54 AC 90 ms
24,928 KB
testcase_55 AC 91 ms
22,856 KB
testcase_56 AC 93 ms
24,952 KB
testcase_57 AC 92 ms
26,992 KB
testcase_58 AC 91 ms
25,088 KB
testcase_59 AC 77 ms
24,544 KB
testcase_60 AC 91 ms
27,012 KB
testcase_61 AC 77 ms
26,588 KB
testcase_62 AC 92 ms
24,996 KB
testcase_63 AC 93 ms
24,924 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let N = stdin.ReadLine().Trim() |> int

let limit = N |> float |> sqrt |> ceil |> int

let ss = [ for i in 1 .. limit do if i*i <= 64 then yield i*i ]

let cs = [ for i in 1 .. limit do if i*i*i <= 64 then yield i*i*i ]

let ns = List.except ss [ 0 .. 64 ] |> List.except cs

let isPrime n =
    let limit = n |> float |> sqrt |> ceil |> int
    let rec check i =
        if i > limit then true elif n % i = 0 then false else check (i+2)
    if n <= 1 then false
    else if n = 2 then true
    else if n % 2 = 0 then false
    else check 3

let prims = [ for i in 2 .. 64 do if isPrime i then i ]

let ps = [6; 28]

if List.exists ((=) N) ss then printfn "Heihosu!"
elif List.exists ((=) N) cs then printfn "Ripposu!"
elif List.exists ((=) N) prims then printfn "Sosu!"
elif List.exists ((=) N) ps then printfn "Kanzensu!"
else printfn "%d" N
0