結果
| 問題 | No.192 合成数 |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-04-26 22:08:44 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 508 bytes |
| 記録 | |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 39,296 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-14 02:37:00 |
| 合計ジャッジ時間 | 1,387 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include <cstdio>
bool isNotPrime[1101];
int main(){
isNotPrime[1] = true;
for(int i=4;i<=1100;i+=2){
isNotPrime[i] = true;
}
for(int i=3;i<=1100;i+=2){
if(!isNotPrime[i]){
for(int j=2*i;j<=1100;j+=i){
isNotPrime[j] = true;
}
}
}
int N;
scanf("%d", &N);
for(int i=N-100;i<=N+100;i++){
if(i == 1){continue;}
if(!isNotPrime[i]){continue;}
printf("%d\n", i);
return 0;
}
}
tottoripaper