标签:des style blog color 使用 os io for
2 10 30
1 4 27
#include <iostream> #include <cstdio> #include <cstring> #include <math.h> #include <cstdlib> #include <algorithm> #define LL long long const int INF = 1e6; using namespace std; LL int dp[501]; int main() { int n; memset(dp,0,sizeof(dp)); int a[21]; for(int j = 1; j<=20; j++) { a[j] = j*j; } memset(dp,0,sizeof(dp)); dp[0] = 1; // dp[1] = 1; for(int i = 1; i<=20; i++) { for(int j = a[i]; j<=501; j++) { dp[j] += dp[j - a[i]]; } } while(~scanf("%d",&n)) cout<<dp[n]<<endl; return 0; }
标签:des style blog color 使用 os io for
原文地址:http://blog.csdn.net/wjw0130/article/details/38371657