Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
601 B
6
Indexable
Never
#include <iostream>
#include<vector>
using namespace std;
vector<long long>catlan(1001);
void helper(){
    int mod = 1e9+7;
    
    catlan.assign(1001,0);
    catlan[0]=1;
    catlan[1]=1;
    for(int i=2;i<1001;i++){
        catlan[i]=0;
        for(int j=0;j<i;j++){
            catlan[i] = (catlan[j]%mod+catlan[i-1-j]%mod)%mod;
        }
    }
}
void solve(){
    int n;
    cin>>n;
    if(n&1){
        cout<<-1<<"\n";
        //return;
    }
    else cout<<catlan[n/2]<<"\n";
}
int main() {
    // your code goes here
    int t;
    helper();
    cin>>t;
    while(t--)solve();
    return 0;
}