結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
![]() |
提出日時 | 2017-03-31 23:56:21 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 668 bytes |
コンパイル時間 | 529 ms |
コンパイル使用メモリ | 32,896 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 06:47:41 |
合計ジャッジ時間 | 4,110 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
ソースコード
program main integer::N integer,parameter::b=LEN_TRIM("a") integer,parameter::a=b-b integer,parameter::c=b+b integer,allocatable::isPr(:) read *,N allocate(isPr(N)) call get_pr(isPr,N) if(isPr(N).eq.a) then print '(a)',"NO" else print '(a)',"YES" end if contains subroutine get_pr(isPr, N) implicit none integer::i,j,N integer,parameter::pr=b,nonpr=a integer,allocatable::isPr(:) isPr=pr isPr(a)=nonpr do i=c, FLOOR(SQRT(REAL(N))) if(isPr(i).eq.pr) then do j=ISHFT(i,b), N, i isPr(j) = nonpr end do end if end do end subroutine get_pr end program main