結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2015-02-04 02:06:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 418 ms |
コンパイル使用メモリ | 55,260 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 07:22:21 |
合計ジャッジ時間 | 1,511 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 2 |
ソースコード
#include <iostream> #include <string> using namespace std; typedef long long ll; string func(ll n) { if (n==1) return "NO"; int cnt=0; for(ll i=2;i*i<=n;++i) { int c=0; if (n%i==0) { while (n%i==0) { c++; n/=i; } cnt++; if (c>1) return "YES"; } } if (n>1) cnt++; return cnt>2 ? "YES" : "NO"; } int main() { ll n; while (cin>>n) cout<<func(n)<<endl; }