結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2021-02-21 12:18:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,137 bytes |
| コンパイル時間 | 800 ms |
| コンパイル使用メモリ | 97,528 KB |
| 実行使用メモリ | 10,140 KB |
| 最終ジャッジ日時 | 2024-09-19 10:21:37 |
| 合計ジャッジ時間 | 7,574 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 10 WA * 1 TLE * 1 -- * 14 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
const ll mod = 998244353;
const ld pi = 3.14159265358979;
ll gcd(ll a , ll b){
if(a < b)swap(a , b);
if(b == 0)return 1;
if(a % b == 0)return b;
else return gcd(b , a % b);
}
bool isPrime(ll x){
if(x == 2 || x == 3 || x == 5 || x == 7){
return true;
}
for(int i = 3; i * i <= x; i++){
if(x % i == 0)return false;
}
return true;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
//cout << fixed << setprecision(15);
ll n;
cin >> n;
vector<ll> v;
for(ll i = 1; i * i <= n; i++){
if(n % i == 0){
v.push_back(i);
if(i != n / i)v.push_back(n / i);
}
}
bool ok = false;
for(int i = 0; i < v.size(); i++){
if(isPrime(v[i]) == false && v[i] != 1){
ok = true;
break;
}
}
if(ok){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
}
mmn15277198