結果

問題 No.36 素数が嫌い!
ユーザー toshiro_yanagi
提出日時 2018-06-23 18:39:02
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 310 bytes
コンパイル時間 2,935 ms
コンパイル使用メモリ 64,828 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 18:31:15
合計ジャッジ時間 3,954 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 x mod i == 0: return false
      if i > x div i: break

  result = true

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