标签:des style blog http color os strong io
Description
Input
Output
Sample Input
Sample Output
#include<stdio.h> #define MAX 310 int main(void) { int n,i,j,k; int c1[MAX],c2[MAX]; while(scanf("%d",&n)!=EOF&&n) { for(i=0;i<=n;i++) { c1[i]=1; c2[i]=0;//当前方程 } for(i=2;i*i<=n;i++){ for(j=0;j<=n;j++){ for(k=0;k+j<=n;k+=i*i) c2[k+j]+=c1[j];//当前方程的系数 向下继承k(各种硬币直)+j } for(j=0;j<=n;j++){ c1[j]=c2[j]; c2[j]=0; } } printf("%d\n",c1[n]); } return 0; }
HDU 1398 Square Coins(母函数),布布扣,bubuko.com
标签:des style blog http color os strong io
原文地址:http://www.cnblogs.com/woshijishu3/p/3868851.html