KOPC12B

#include <iostream> #include <fstream> #include <string> #include <algorithm> #define MOD 1000000007 using namespace std; int choose(int n) { if(n==1) return 1; int ans = 1; for(int i=2*n;i>n;i--) { ans *= i/(i-n); ans %= MOD; } return ans; } int main() { int t,n; ios_base::sync_with_stdio(false); cin>>t; while(t) { cin>>n; if(n!=1) cout<< ((n/2) * choose(n)) % MOD<<endl; else cout<<1<<endl; t--; } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.