結果
| 問題 |
No.8023 素数判定するだけ
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2017-04-01 00:05:06 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 919 bytes |
| コンパイル時間 | 1,468 ms |
| コンパイル使用メモリ | 32,896 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 20:12:05 |
| 合計ジャッジ時間 | 4,457 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
Main.f90:11:22:
11 | write(cf(d:d),'(a)'), ACHAR(f)
| 1
Warning: Legacy Extension: Comma before i/o item list at (1)
ソースコード
program main
integer::N
integer,parameter::a=LEN_TRIM("")
integer,parameter::b=LEN_TRIM("a")
integer,parameter::c=LEN_TRIM("aa")
integer,parameter::d=LEN_TRIM("aaa")
integer,parameter::e=LEN_TRIM("aaaa")
integer,parameter::f=LEN_TRIM("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
character(len=e)::cf='(i )'
integer,allocatable::isPr(:)
write(cf(d:d),'(a)'), ACHAR(f)
read cf,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(b)=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
jj