結果

問題 No.36 素数が嫌い!
ユーザー jjjj
提出日時 2016-10-10 00:05:34
言語 Fortran
(gFortran 13.2.0)
結果
RE  
実行時間 -
コード長 524 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 32,892 KB
実行使用メモリ 583,372 KB
最終ジャッジ日時 2024-05-01 18:43:37
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 MLE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 39 ms
133,424 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer*8::N,i,j
  integer*8::upper
  integer*8,allocatable::isPrime(:)
  read *,N
  if(N.eq.1) then
     print '(a)', "NO"
     return
  end if

  allocate(isPrime(N))
  isPrime = 1
  upper = FLOOR(SQRT(REAL(N)))

  do i=2, FLOOR(SQRT(REAL(N)))
     if(isPrime(i).eq.1) then
        if(MOD(N,i).eq.0) then
           print '(a)', "YES"
           return
        end if
        do j=i+i, N, i
           isPrime(j) = 0
        end do
     end if
  end do

  print '(a)', "NO"
end program main
0