标签:closed sed spl mod span cli int tps display
1 #include <iostream> 2 using namespace std; 3 4 const int mod = 1e9+7; 5 6 long long qmi(long long a, long long k, long long p) 7 { 8 long long res = 1; 9 while (k) 10 { 11 if (k & 1) res = res * a % p; 12 a = a * a % p; 13 k >>= 1; 14 } 15 return res; 16 } 17 18 int main(){ 19 long long n;cin >> n; 20 long long res = 1; 21 for(int i = 2*n;i > n;--i) res = res * i % mod; 22 for(int i = 1;i <= n;++i) res = res * qmi(i, mod-2, mod) % mod; 23 res = res * qmi(n+1, mod-2, mod) % mod; 24 cout << res << endl; 25 return 0; 26 }
标签:closed sed spl mod span cli int tps display
原文地址:https://www.cnblogs.com/sxq-study/p/12283466.html