結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
|
提出日時 | 2023-10-27 23:51:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 721 ms |
コンパイル使用メモリ | 66,320 KB |
最終ジャッジ日時 | 2025-02-17 16:14:55 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
ソースコード
#include <iostream> using namespace std; int zero = !'a'; int one = !!'a'; int two = one + one; int plus_one(int x) { int i = one; while(x & i) { x ^= i; i = i << one; } x |= i; return x; } int main() { int n; cin >> n; bool f = (n != one); for(int i = two; i < n; i = plus_one(i)) { if(n % i == zero) f = false; } cout << (f ? "YES" : "NO") << '\n'; }