标签:微软 math str 输出 lin ret white mit math.h
所以活着的同一时候,为什么不做一做平方数?
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;
}
标签:微软 math str 输出 lin ret white mit math.h
原文地址:http://www.cnblogs.com/lytwajue/p/7259842.html