結果

問題 No.36 素数が嫌い!
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-12-29 17:24:30
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 3,134 ms
コンパイル使用メモリ 64,360 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 06:18:38
合計ジャッジ時間 4,442 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, math


proc nextString: string =
    result = ""
    while not endOfFile stdin:
        let nextChar = readChar stdin
        case nextChar
        of '\r':
            discard
        of "\n"[0], ' ':
            break
        else:
            add result, nextChar


proc nextInt: int =
    return parseInt nextString()


proc judge(n: int): bool =
    for i in 2 ..< n :
        if n mod i == 0:
            return true
        if i ^ 2 > n:
            return


proc main: void =
    let n = nextInt()
    writeLine stdout, ["NO", "YES"][int judge n]


when isMainModule:
    main()
0