結果
| 問題 |
No.8023 素数判定するだけ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-15 01:04:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 502 bytes |
| コンパイル時間 | 497 ms |
| コンパイル使用メモリ | 61,172 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 02:17:32 |
| 合計ジャッジ時間 | 4,422 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int one = int(true);
int zero = int(false);
int incl(int a) {
int b = one;
bool c = true;
int t = a;
while(c) {
if(a & b) {
t ^= b;
} else {
t |= b;
c = false;
}
b <<= one;
}
return t;
}
int main() {
int N;
cin >> N;
bool ans = true;
for(int i = incl(one); i < N; i = incl(i)) {
if(N % i == zero) ans = false;
}
if(N == one) ans = false;
cout << (ans ? "YES" : "NO") << endl;
return zero;
}