結果
| 問題 | No.308 素数は通れません |
| コンテスト | |
| ユーザー |
holeguma
|
| 提出日時 | 2015-12-01 04:18:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 911 bytes |
| 記録 | |
| コンパイル時間 | 710 ms |
| コンパイル使用メモリ | 85,200 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-14 06:30:19 |
| 合計ジャッジ時間 | 5,285 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 90 TLE * 1 -- * 16 |
ソースコード
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
bool isPrime(ll n){
if(n%2==0) return false;
for(int i=3;i<=sqrt(n);i+=2){
if(n%i==0) return false;
}
return true;
}
void solve(){
ll n;
cin >> n;
if(n==4) cout << 3 <<endl;
else if(n==6) cout << 5 <<endl;
else if(n==8||n==9||n==10||n==15||n==16||n==22) cout << 7 <<endl;
else if(n==12) cout << 11 <<endl;
else if(n==14||n==15) cout << 13 <<endl;
else if(n==20||n==21) cout << 19 <<endl;
else if(n==24||n==25) cout << 23 <<endl;
else if(n%8==1&&isPrime(n-8)) cout << 14 <<endl;
else cout << 8 <<endl;
}
int main(){
solve();
return 0;
}
holeguma