Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <iostream>

#include <string>
using namespace std;

int MathChallenge(int num) {


int denom[5] = {1, 5, 7, 9, 11};
int dp[251] = {0};

for(int i = 1; i <= num; ++i) {


int c = dp[i - 1];
for(int j = 1; j < 5; ++j) {
int k = i - denom[j];
if(k >= 0) {
c = min(c, dp[k]);
}
}
c += 1;
dp[i] = c;
}
return dp[num];
}

int main(void) {

// keep this function call here


cout << MathChallenge(coderbyteInternalStdinFunction(stdin));
return 0;

You might also like