Given a integer N. Find number of possible ways to represent N as a sum of at most five cubes.
Input
First line contains N.
1<=N<=125000.
Output
Output the result
Example
Input: 64 Output: 2
这种题目。。直接暴力吧
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<cstdlib> 5 #include<algorithm> 6 #include<queue> 7 #include<deque> 8 #include<set> 9 #include<map> 10 #include<ctime> 11 #define LL long long 12 #define inf 0x7ffffff 13 #define pa pair<int,int> 14 #define pi 3.1415926535897932384626433832795028841971 15 using namespace std; 16 inline LL read() 17 { 18 LL x=0,f=1;char ch=getchar(); 19 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 20 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 21 return x*f; 22 } 23 inline void write(LL a) 24 { 25 if (a<0){printf("-");a=-a;} 26 if (a>=10)write(a/10); 27 putchar(a%10+'0'); 28 } 29 inline void writeln(LL a){write(a);printf("\n");} 30 int n,m,tot,ans; 31 int p[51]; 32 int mrk[125001]; 33 int main() 34 { 35 scanf("%d",&n); 36 for (int i=1;i<=50;i++)p[i]=i*i*i,mrk[p[i]]=i; 37 for (int i=0;i<=50;i++) 38 { 39 if (tot+p[i]>n)break; 40 tot+=p[i]; 41 for (int j=i;j<=50;j++) 42 { 43 if(tot+p[j]>n)break; 44 tot+=p[j]; 45 for (int k=j;k<=50;k++) 46 { 47 if (tot+p[k]>n)break; 48 tot+=p[k]; 49 for (int l=k;l<=50;l++) 50 { 51 if (tot+p[l]>n)break; 52 tot+=p[l]; 53 for (int m=l;m<=50;m++) 54 if (tot+p[m]==n)ans++; 55 tot-=p[l]; 56 } 57 tot-=p[k]; 58 } 59 tot-=p[j]; 60 } 61 tot-=p[i]; 62 } 63 printf("%d\n",ans); 64 }