#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define inf 0x3f3f3f3f
#define eps 1e-8
#define ll long long
#define ull unsigned long long
#define For( i, x, y ) for( int i = x; i <= y; ++i )
#define mxn 10200
int dp[mxn];
int m[20];
int main() {
int n;
For( i, 1, 18 )
m[i] = i * i;
while( cin >> n && n ) {
memset( dp, 0, sizeof( dp ) );
dp[0] = 1;
For( i, 1, 17 ) {
For( j, m[i], n )
dp[j] += dp[j-m[i]];
}
cout << dp[n] << endl;
}
return 0;
}
HDU 1398 Square coins 完全背包
最新推荐文章于 2019-10-06 08:12:40 发布