結果
| 問題 | No.8023 素数判定するだけ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-12 22:06:42 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 338 bytes |
| 記録 | |
| コンパイル時間 | 364 ms |
| コンパイル使用メモリ | 85,228 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-20 13:45:17 |
| 合計ジャッジ時間 | 2,984 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <iostream>
#include <cmath>
#include <functional>
using namespace std;
int zero='a'%'a';
int one='b'%'a';
int two='c'%'a';
int p(int n){
if(n==one)return false;
for(int i=two;i<=sqrt(n);i=plus<int>()(i,one)){
if(n%i==zero){
return false;
}
}
return true;
}
int main() {
int n;cin>>n;
cout<<(p(n)?"YES":"NO")<<endl;
}