#include<iostream>
using namespace std;
long long d[101][101];
int dp(int n, int first)
{
if(n==first)return 1;
if(n<first)return 0;
long long &ret = d[n][first];
if(ret != -1 ) return ret;
long long ans = 0;
for(int second = 1; second<=n-first; second++)
{
ans += dp(n-first, second)*(first+second-1);
ans%=10000000;
}
return ret = ans;
}
int main()
{
int C,n;
cin>>C;
memset(d,-1,sizeof(d));
while(C--)
{
cin>>n;
long long ans = 0;
for(int first = 1; first<=n; first++)
{
ans += dp(n, first);
ans%=10000000;
}
cout<<ans<<endl;
}
}
'알고리즘 > JM북' 카테고리의 다른 글
p312 드래곤 커브 (0) | 2017.02.13 |
---|---|
p270 두니발 박사의 탈옥 (0) | 2017.02.13 |
156p 소풍 (0) | 2017.02.05 |
149p 조합 찾기 (0) | 2017.02.05 |
2장 p30 사탕 나눠주기 (0) | 2017.01.30 |