My issue
as the number of test case isn’t given in the input section …what should I do to modify my code so that it can run for every cases given in input .
My code
#include <bits/stdc++.h>
const long long int N=10e7;
using namespace std;
int dp[N];
int func(int n)
{
if(n<=11) return n;
else if(dp[n]!=-1) return dp[n];
else
return dp[n]=max(n,func(n/2)+func(n/3)+func(n/4));
}
int main() {
// your code goes here
memset(dp,-1,sizeof(dp));
int n;
cin>>n;
cout<<func(n)<<endl;
return 0;
}
Problem Link: COINS Problem - CodeChef