結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
|
提出日時 | 2024-10-07 15:32:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 1,000 ms |
コード長 | 164 bytes |
コンパイル時間 | 701 ms |
コンパイル使用メモリ | 63,152 KB |
最終ジャッジ日時 | 2025-02-24 16:25:59 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<ios> | ^~~~~~ main.cpp:2:79: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | int n,z,o=true,i=o;void g(int &a,int b=o){while(b){int t=a;a^=b;b=(t&b)<<!z;}}main(){scanf("%ld",&n);for(g(i);i<n;g(i))n=n%i?n:z;puts(n>o?"YES":"NO");} | ^~~~ main.cpp: In function ‘int main()’: main.cpp:2:95: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘int*’ [-Wformat=] 2 | int n,z,o=true,i=o;void g(int &a,int b=o){while(b){int t=a;a^=b;b=(t&b)<<!z;}}main(){scanf("%ld",&n);for(g(i);i<n;g(i))n=n%i?n:z;puts(n>o?"YES":"NO");} | ~~^ ~~ | | | | | int* | long int* | %d main.cpp:2:91: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 2 | int n,z,o=true,i=o;void g(int &a,int b=o){while(b){int t=a;a^=b;b=(t&b)<<!z;}}main(){scanf("%ld",&n);for(g(i);i<n;g(i))n=n%i?n:z;puts(n>o?"YES":"NO");} | ~~~~~^~~~~~~~~~
ソースコード
#import<ios> int n,z,o=true,i=o;void g(int &a,int b=o){while(b){int t=a;a^=b;b=(t&b)<<!z;}}main(){scanf("%ld",&n);for(g(i);i<n;g(i))n=n%i?n:z;puts(n>o?"YES":"NO");}