結果

問題 No.36 素数が嫌い!
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-23 18:37:15
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 310 bytes
コンパイル時間 3,031 ms
コンパイル使用メモリ 66,060 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 18:31:11
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import strutils, math
let N = stdin.readLine.parseInt

proc isPrime(x: int): bool =
  if x != 2:
    if x == 1 or (x mod 2 == 0): return false

    for i in countup(3, int.high, 2):
      if i > x div i: break
      if x mod i == 0: return false

  result = true

echo if N.isPrime or N == 1: "NO" else: "YES"
0