Submission #74425
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; bool poland[n+1]={}; poland[0]= true ; poland[1]= true ; for ( int i=3; i*i<n; i+=2){ if (!poland[i]){ for ( int j=i+i; j<=n; j+=i){ poland[j]= true ; } } } cout<<2<< "\n" ; for ( int i=3; i<=n; i+=2){ if (!poland[i]){ cout<<i<< "\n" ; } } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0437 - 素数 |
ユーザー名 | ei2312 |
投稿日時 | 2023-07-11 16:20:32 |
言語 | C++17 |
状態 | Accepted |
得点 | 4 |
ソースコード長 | 459 Byte |
最大実行時間 | 37 ms |
最大メモリ使用量 | 1256 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 4 / 4 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
sosu_input01 | AC | 33 ms | 476 KB |
1
|
sosu_input02 | AC | 19 ms | 576 KB |
1
|
sosu_input03 | AC | 31 ms | 556 KB |
1
|
sosu_input04 | AC | 21 ms | 524 KB |
1
|
sosu_input05 | AC | 37 ms | 1256 KB |
1
|