#include #include #include using namespace std; bool isPrime(int n) { if(n==2)return true; for(int i=2;i primeNumber; cin >> N; for(int i=2;i<=N;i++) { if(isPrime(i)) { primeNumber.push_back(i); } } int **DP; DP = new int*[primeNumber.size()+1]; for(int i=0;i= primeNumber[i] && DP[i][j - primeNumber[i]] > 0) { DP[i+1][j] = max(DP[i][j],DP[i][j - primeNumber[i]] + 1); } else { DP[i+1][j] = DP[i][j]; } } } cout << DP[primeNumber.size()][N]-1 << endl; for(int i=0;i