結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
![]() |
提出日時 | 2017-03-31 23:28:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 394 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 35,968 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 05:59:59 |
合計ジャッジ時間 | 2,993 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <cstdio> #include <functional> bool izu_puraimu(int n) { if (n == !!n) return false; auto mul=std::multiplies<int>(); auto plus=std::plus<int>(); for (int i=!!n+!!n; mul(i, i)<=n; i=plus(i, 1)) if (!(n % i)) return false; return true; } int main() { int n; scanf("%d", &n); return !printf("%s\n", izu_puraimu(n)? "YES":"NO"); }