結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2015-06-25 23:42:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 102 ms / 5,000 ms |
コード長 | 979 bytes |
コンパイル時間 | 616 ms |
コンパイル使用メモリ | 85,688 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 00:20:21 |
合計ジャッジ時間 | 1,921 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <list> #include <queue> #include <vector> #include <complex> #include <set> ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<<endl; ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// LL prime(LL num){ for(LL i=2;i*i<=num;++i){ if(num%i == 0){ return num/i; } } return 0; } int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(6);// LL N; cin>>N; //素数以外で割り切れる数 //1とN以外で割り切れる数 LL fact = N; LL temp; int ans=0; do { temp = prime(fact); if(temp == 0){ ++ans; break; }else{ fact = temp; ++ans; } }while(ans<3); if(ans < 3){ P("NO"); }else{ P("YES"); } return 0; }