11137 - Ingenuous Cubrency

All about problems in Volume 111. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

asmaa
New poster
Posts: 4
Joined: Thu Jul 04, 2013 11:25 pm

my code is always WA i need help please :(

Post by asmaa » Thu Jul 04, 2013 11:35 pm

Code: Select all

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
long long LCS[10005][10005];
int main()
{
	int n;
	vector<int>div;
	while(cin>>n)
	{
		if(n<=10000&&n>0)
		{
		for(int i=0;i<n;i++)
		{
			if((i*i*i)>n)
				break;
			div.push_back(i*i*i);
		}
		for(int i=0;i<div.size();i++)
			LCS[0][i]=1;
		for(int i=0;i<=n;i++)
			LCS[i][0]=0;
		for(int i=1;i<=n;i++)
			for(int j=1;j<div.size();j++)
			{
				if(div[j]<=i)
					LCS[i][j]=LCS[i][j-1]+LCS[i-div[j]][j];
				else
					LCS[i][j]=LCS[i][j-1];
			}
			
			cout<<LCS[n][div.size()-1]<<endl;
			for(int i=1;i<=n;i++)
			for(int j=1;j<div.size();j++)
				LCS[i][j]=0;
			div.clear();
		}
	}
	return 0;
} :( 

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11137 - Ingenuous Cubrency

Post by brianfry713 » Fri Jul 05, 2013 11:10 pm

Input 1 output should be 1.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 111 (11100-11199)”