結果

問題 No.192 合成数
ユーザー NotationNap
提出日時 2015-04-26 22:05:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 1,257 ms
コンパイル使用メモリ 159,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 01:26:56
合計ジャッジ時間 2,352 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

typedef long long Int;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);++(i))

bool isPrime(int N) {
	if (N == 2 || N == 3) return true;
	for (int i = 2; i * i <= N; i++) if (N % i == 0) return false;
	return true;
}
int main() {
	int N; cin >> N;
	
	while (isPrime(N)) {
		N++;
	}
	cout << N << endl;
}
0