标签:
1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 int main() 5 { 6 int c1[310],c2[310]; 7 int i,j,k,n; 8 while(cin>>n&&n) 9 { 10 for(i=0;i<=n;i++) 11 { 12 c1[i]=1; 13 c2[i]=0; 14 } 15 for(i=2;i<=n;i++) 16 { 17 for(j=0;j<=n;j++) 18 { 19 for(k=0;j+k<=n;k+=i*i) 20 c2[j+k]+=c1[j]; 21 } 22 for(j=0;j<=n;j++) 23 { 24 c1[j]=c2[j]; 25 c2[j]=0; 26 } 27 } 28 cout<<c1[n]<<endl; 29 } 30 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4682381.html