#include using namespace std; #define pb push_back typedef long long ll; const ll INF = 1000000000000000000ll; const ll MOD = 1000000007ll; const double EPS = 1e-8; #define N 30000 bool prime[N]; vector p; int dp[20001]; void Eratos(int n){ for(int i=0; i> n; Eratos(n+1); for(int i=0; i<=n; i++){ dp[i] = -1; } dp[0] = 0; for(int i=1; i=0; j--){ if(j + p[i] <= n && dp[j] != -1){ dp[j + p[i]] = max(dp[j + p[i]], dp[j] + 1); } } } cout << dp[n] << endl; return 0; }