Hi, everyone. I want to know the i — term (mod 1000000007) to the Catalan serie and I really don't know if my solution works. Do you, please, can explain me, if this way I get the answer? I need some help, thanks everybody.
- long long c,n,i,j;
- long long fact[1005][1005];
- int main()
- {
- fact[1][1] = 1;
- for(i=2;i<=1000;i++)
- {
- for(j=1;j<=i;j++)
- {
- if(j == 1)
- fact[i][1] = 1;
- else
- {
- if(i == j)
- fact[i][j] = fact[i][j-1] + fact[i-1][j-1];
- else
- fact[i][j] = fact[i][j-1] + fact[i-1][j];
- fact[i][j] %= 1000000007;
- }
- }
- }
- scanf("%d",&c);
- while(c--)
- {
- scanf("%d",&n);
- printf("%ld\n",fact[n][n]);
- }
- return 0;
- }
What you ask for is very unclear. Adding at least one interrogative sentence (ending with ?) could help.