結果
問題 | No.8023 素数判定するだけ |
ユーザー |
|
提出日時 | 2023-10-27 23:52:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 65,980 KB |
最終ジャッジ日時 | 2025-02-17 16:16:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream> using namespace std; int zero = !'a'; int one = !!'a'; 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 = one << one; i < n; i = plus_one(i)) { if(n % i == zero) f = false; } cout << (f ? "YES" : "NO") << '\n'; }