結果
問題 | No.8023 素数判定するだけ |
ユーザー |
|
提出日時 | 2023-10-27 23:51:38 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 716 ms |
コンパイル使用メモリ | 67,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-25 15:36:19 |
合計ジャッジ時間 | 5,444 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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'; }