結果
| 問題 |
No.8023 素数判定するだけ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-05 05:57:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 250 bytes |
| コンパイル時間 | 162 ms |
| コンパイル使用メモリ | 27,264 KB |
| 最終ジャッジ日時 | 2025-01-10 06:41:44 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | int n; scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>
using namespace std;
int main(){
int n; scanf("%d",&n);
bool ok=true;
if(n=='B'%'A') ok=false;
for(int i='C'%'A';i<n;){
if(!(n%i)) ok=false;
int m=true;
while(i&m){ i=i^m; m<<=true; }
i=i^m;
}
puts(ok?"YES":"NO");
}