标签:des blog http io ar os sp for strong
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<cstdlib> #include<algorithm> #include<queue> #include<vector> #include<set> using namespace std; int n,f[310][310]; long long ans; void init() { for(int i=0;i<=310;i++) f[i][1]=1; for(int i=1;i<=310;i++) for(int j=1;j<=i;j++) if(j==i) f[i][j]=f[i][j-1]+1; else f[i][j]=f[i][j-1]+f[i-j][min(i-j,j)]; } int main() { init(); while(scanf("%d",&n),n) { ans=0; for(int i=1;i<n;i++) if((n-i)%2==0) { ans+=f[(n-i)/2][min((n-i)/2,i)]; } if(n%2==0) ans+=f[n/2][n/2]; printf("%d %lld\n",n,ans+1); } return 0; }
标签:des blog http io ar os sp for strong
原文地址:http://www.cnblogs.com/a972290869/p/4102492.html