結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
かに
|
| 提出日時 | 2015-08-08 15:22:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,468 bytes |
| コンパイル時間 | 716 ms |
| コンパイル使用メモリ | 91,952 KB |
| 実行使用メモリ | 10,148 KB |
| 最終ジャッジ日時 | 2024-07-18 05:53:39 |
| 合計ジャッジ時間 | 10,384 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 5 TLE * 1 -- * 20 |
ソースコード
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define aLL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXISt(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define MAX 100000000
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};
int sttoi(std::string str){int ret;std::stringstream ss;ss << str;ss >> ret;return ret;}
list<pair<int,int> > lis;
bool isPrime(int n){
if(n == 2) return true;
if(n%2 == 0)return false;
for(int i = 3;i*i <= n;i+=2){
if(n%i == 0){
return false;
}
}
return true;
}
int main(){
ll n;
cin >> n;
if(n == 1){
P("NO");
return 0;
}
for(int i = 2;i <= n/2;i++){
if(isPrime(i))continue;
if(n%i == 0){
P("YES");
return 0;
}
}
P("NO");
}
かに