結果
問題 | No.308 素数は通れません |
ユーザー | shimomire |
提出日時 | 2015-12-01 00:28:23 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 6,463 bytes |
コンパイル時間 | 1,021 ms |
コンパイル使用メモリ | 114,540 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 05:30:06 |
合計ジャッジ時間 | 3,673 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | WA | - |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | WA | - |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | AC | 2 ms
6,940 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 2 ms
6,940 KB |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 1 ms
6,944 KB |
testcase_30 | AC | 2 ms
6,944 KB |
testcase_31 | AC | 2 ms
6,944 KB |
testcase_32 | WA | - |
testcase_33 | AC | 1 ms
6,944 KB |
testcase_34 | AC | 2 ms
6,940 KB |
testcase_35 | AC | 2 ms
6,940 KB |
testcase_36 | AC | 2 ms
6,940 KB |
testcase_37 | AC | 2 ms
6,944 KB |
testcase_38 | AC | 2 ms
6,944 KB |
testcase_39 | AC | 2 ms
6,940 KB |
testcase_40 | AC | 2 ms
6,944 KB |
testcase_41 | AC | 2 ms
6,940 KB |
testcase_42 | AC | 1 ms
6,940 KB |
testcase_43 | AC | 2 ms
6,940 KB |
testcase_44 | AC | 2 ms
6,940 KB |
testcase_45 | AC | 2 ms
6,944 KB |
testcase_46 | AC | 2 ms
6,944 KB |
testcase_47 | AC | 2 ms
6,940 KB |
testcase_48 | AC | 2 ms
6,944 KB |
testcase_49 | AC | 2 ms
6,944 KB |
testcase_50 | AC | 2 ms
6,940 KB |
testcase_51 | AC | 2 ms
6,940 KB |
testcase_52 | AC | 2 ms
6,940 KB |
testcase_53 | AC | 1 ms
6,940 KB |
testcase_54 | AC | 2 ms
6,940 KB |
testcase_55 | AC | 1 ms
6,940 KB |
testcase_56 | AC | 1 ms
6,944 KB |
testcase_57 | AC | 1 ms
6,944 KB |
testcase_58 | AC | 2 ms
6,940 KB |
testcase_59 | AC | 2 ms
6,940 KB |
testcase_60 | AC | 1 ms
6,944 KB |
testcase_61 | AC | 2 ms
6,944 KB |
testcase_62 | AC | 2 ms
6,944 KB |
testcase_63 | AC | 1 ms
6,940 KB |
testcase_64 | AC | 2 ms
6,940 KB |
testcase_65 | AC | 2 ms
6,940 KB |
testcase_66 | AC | 2 ms
6,944 KB |
testcase_67 | AC | 1 ms
6,944 KB |
testcase_68 | AC | 2 ms
6,940 KB |
testcase_69 | AC | 2 ms
6,940 KB |
testcase_70 | AC | 2 ms
6,940 KB |
testcase_71 | AC | 1 ms
6,944 KB |
testcase_72 | AC | 2 ms
6,940 KB |
testcase_73 | AC | 1 ms
6,940 KB |
testcase_74 | AC | 2 ms
6,940 KB |
testcase_75 | AC | 2 ms
6,940 KB |
testcase_76 | WA | - |
testcase_77 | AC | 1 ms
6,940 KB |
testcase_78 | AC | 2 ms
6,944 KB |
testcase_79 | AC | 2 ms
6,940 KB |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | AC | 2 ms
6,940 KB |
testcase_83 | AC | 2 ms
6,944 KB |
testcase_84 | WA | - |
testcase_85 | AC | 1 ms
6,940 KB |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | AC | 2 ms
6,940 KB |
testcase_89 | AC | 1 ms
6,944 KB |
testcase_90 | WA | - |
testcase_91 | AC | 1 ms
6,940 KB |
testcase_92 | AC | 2 ms
6,944 KB |
testcase_93 | AC | 2 ms
6,940 KB |
testcase_94 | AC | 2 ms
6,944 KB |
testcase_95 | AC | 2 ms
6,940 KB |
testcase_96 | AC | 2 ms
6,940 KB |
testcase_97 | AC | 2 ms
6,944 KB |
testcase_98 | AC | 2 ms
6,940 KB |
testcase_99 | AC | 2 ms
6,944 KB |
testcase_100 | AC | 2 ms
6,940 KB |
testcase_101 | WA | - |
testcase_102 | AC | 2 ms
6,940 KB |
testcase_103 | AC | 2 ms
6,944 KB |
testcase_104 | AC | 1 ms
6,944 KB |
testcase_105 | AC | 2 ms
6,940 KB |
testcase_106 | AC | 2 ms
6,940 KB |
ソースコード
#include <cassert>// c #include <iostream>// io #include <iomanip> #include <fstream> #include <sstream> #include <vector>// container #include <map> #include <set> #include <queue> #include <bitset> #include <stack> #include <algorithm>// other #include <complex> #include <numeric> #include <functional> #include <random> #include <regex> using namespace std; typedef long long ll;typedef unsigned long long ull;typedef long double ld; #define ALL(c) c.begin(),c.end() #define IN(l,v,r) (l<=v && v < r) template<class T> void UNIQUE(T v){v.erase(unique(ALL(v)),v.end());} //debug #define DUMP(x) cerr << #x <<" = " << (x) #define LINE() cerr<< " (L" << __LINE__ << ")" struct range{ struct Iter{ int v,step; Iter& operator++(){v+=step;return *this;} bool operator!=(Iter& itr){return v<itr.v;} int& operator*(){return v;} }; Iter i, n; range(int i, int n,int step):i({i,step}), n({n,step}){} range(int i, int n):range(i,n,1){} range(int n):range(0,n){} Iter& begin(){return i;} Iter& end(){return n;} }; struct rrange{ struct Iter{ int v,step; Iter& operator++(){v-=step;return *this;} bool operator!=(Iter& itr){return v>itr.v;} int& operator*(){return v;} }; Iter i, n; rrange(int i, int n,int step):i({i-1,step}), n({n-1,step}){} rrange(int i, int n):rrange(i,n,1){} rrange(int n) :rrange(0,n){} Iter& begin(){return n;} Iter& end(){return i;} }; //input template<typename T1,typename T2> istream& operator >> (istream& is,pair<T1,T2>& p){return is>>p.first>>p.second;} template<typename T1> istream& operator >> (istream& is,tuple<T1>& t){return is >> get<0>(t);} template<typename T1,typename T2> istream& operator >> (istream& is,tuple<T1,T2>& t){return is >> get<0>(t) >> get<1>(t);} template<typename T1,typename T2,typename T3> istream& operator >> (istream& is,tuple<T1,T2,T3>& t){return is >>get<0>(t)>>get<1>(t)>>get<2>(t);} template<typename T1,typename T2,typename T3,typename T4> istream& operator >> (istream& is,tuple<T1,T2,T3,T4>& t){return is >> get<0>(t)>>get<1>(t)>>get<2>(t)>>get<3>(t);} template<typename T> istream& operator >> (istream& is,vector<T>& as){for(int i:range(as.size()))is >>as[i];return is;} //output template<typename T> ostream& operator << (ostream& os, const set<T>& ss){for(auto a:ss){if(a!=ss.begin())os<<" "; os<<a;}return os;} template<typename T1,typename T2> ostream& operator << (ostream& os, const pair<T1,T2>& p){return os<<p.first<<" "<<p.second;} template<typename K,typename V> ostream& operator << (ostream& os, const map<K,V>& m){bool isF=true;for(auto& p:m){if(!isF)os<<endl;os<<p;isF=false;}return os;} template<typename T1> ostream& operator << (ostream& os, const tuple<T1>& t){return os << get<0>(t);} template<typename T1,typename T2> ostream& operator << (ostream& os, const tuple<T1,T2>& t){return os << get<0>(t)<<" "<<get<1>(t);} template<typename T1,typename T2,typename T3> ostream& operator << (ostream& os, const tuple<T1,T2,T3>& t){return os << get<0>(t)<<" "<<get<1>(t)<<" "<<get<2>(t);} template<typename T1,typename T2,typename T3,typename T4> ostream& operator << (ostream& os, const tuple<T1,T2,T3,T4>& t){return os << get<0>(t)<<" "<<get<1>(t)<<" "<<get<2>(t)<<" "<<get<3>(t);} template<typename T> ostream& operator << (ostream& os, const vector<T>& as){for(int i:range(as.size())){if(i!=0)os<<" "; os<<as[i];}return os;} template<typename T> ostream& operator << (ostream& os, const vector<vector<T>>& as){for(int i:range(as.size())){if(i!=0)os<<endl; os<<as[i];}return os;} // values template<typename T> inline T INF(){assert(false);}; template<> inline int INF<int>(){return 1<<28;}; template<> inline ll INF<ll>(){return 1LL<<58;}; template<> inline double INF<double>(){return 1e16;}; template<> inline long double INF<long double>(){return 1e16;}; template<class T> inline T EPS(){assert(false);}; template<> inline int EPS<int>(){return 1;}; template<> inline ll EPS<ll>(){return 1LL;}; template<> inline double EPS<double>(){return 1e-8;}; template<> inline long double EPS<long double>(){return 1e-8;}; // min{2^r | n < 2^r} template<typename T> T upper_pow2(T n){ T res=1;while(res<n)res<<=1;return res;} // max{d | 2^d <= n} template<typename T> T msb(T n){ int d=62;while((1LL<<d)>n)d--;return d;} template<typename T,typename U> T pmod(T v,U M){return (v%M+M)%M;} ll gcd_positive(ll a,ll b) { return b == 0 ? a : gcd_positive(b,a%b); } ll gcd(ll a,ll b) { return gcd_positive(abs(a), abs(b)); } ll lcm(ll a,ll b){return a/gcd(a,b)*b;} template<class Cost> struct Edge{ int from,to;Cost cost; Edge(int from,int to,Cost cost):from(from),to(to),cost(cost){}; bool operator<(Edge r) const{ return cost<r.cost;} bool operator>(Edge r) const{ return cost>r.cost;} }; // W = 2 // 1 x2 // x3 // W = 3 // 1 x2 x3 // 4 x5 // x7 // W = 4 // 1 x2 // x5 // W = 5 // 1 x2 // 6 x7 // x11 // W = 6 // 1 x2 // x7 // W = 7 // 1 x2 x3 // 8 9 10 x11 // 15 16 x17 // 22 x23 // x29 // W = 8 // 1 x2 x3 4 x5 6 x7 8 // 9 10 x11 12 x13 14 15 16 // x17 18 x19 20 21 22 x23 24 // 25 26 27 28 29 30 x31 32 // x33 34 35 36 x37 38 x39 40 // W = 9 // 1 x2 // 10 x11 // x19 // W = 10 // 1 x2 // x11 // W = 11 // 1 x2 x3 4 x5 6 x7 8 9 10 x11 // 12 x13 14 15 16 x17 18 x19 20 21 22 // x23 24 // W = 12 // 1 x2 x3 4 x5 6 x7 8 9 10 x11 12 // x13 14 15 16 x17 18 x19 20 21 22 x23 24 class Main{ public: void run(){ ll N;cin >> N; if(N>=25){ cout << 8 << endl;return; } // N = 4,6,8,9,10,12,14,15,16,18,20,21,22,24 if(N== 4){ cout << 3 << endl;return; } if(N==6){ cout << 5 <<endl;return; } if(N==8 || N == 9 || N == 10 || N == 15 || N == 16 || N == 22){ cout << 7 << endl;return; } // N = 12,14,18,20,21,24 if(N==12){ cout << 11 <<endl;return; } if(N==14){ cout << 13 <<endl;return; } if(N==18){ cout << 17 <<endl;return; } if(N==20 || N == 21){ cout << 19 << endl;return; } if(N==24){ cout << 23 << endl;return; } } }; int main(){ cout <<fixed<<setprecision(20); cin.tie(0); ios::sync_with_stdio(false); Main().run(); return 0; }