結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
|
提出日時 | 2018-05-15 20:41:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 536 bytes |
コンパイル時間 | 551 ms |
コンパイル使用メモリ | 69,276 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-28 12:10:54 |
合計ジャッジ時間 | 1,901 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 9 |
ソースコード
#include<iostream> #include<cmath> using namespace std; typedef long long ll; bool isPrime(ll a){ for(ll i = 2; i <= sqrt(a); i++){ if(a%i == 0) return false; } return true; } int main(){ ll n; cin >> n; for(int i = 2; i <= sqrt(n); i++){ if(n % i == 0){ if(!isPrime(n)){ cout << "YES" << endl; return 0; } while(n%i == 0){ n /= i; } } } cout << "NO" << endl; return 0; }