#include #include #include #include #include #include using namespace std; #define INF 2000000007 #define MOD 1000003 #define MAX 105 #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) typedef unsigned int uint; typedef unsigned long long int ull; vector prime(int N){ int cnt = 1; vector pn(N+1); REPS(i,N,1) pn[i]=i; for(int i=4;i p(cnt); for(int i=0,j=2;j>N; vector pn = prime(N+1);// size : 5637 for(int i:pn) DP[i]=1; for(int i:pn){ //cout << i << endl; for(int j=N;j>i;--j){ //REP(j,N+1){ if(j-i<=1)continue; if(j-i==i)continue; if(DP[j-i]==0)continue; DP[j] = max(DP[j],DP[j-i]+1); } } cout << (DP[N] > 0 ? DP[N] : -1) << endl; return 0; }