Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
109861 | 陈志轩 | 凸多边形的三角形剖分 | C++ | 通过 | 100 | 0 MS | 248 KB | 1312 | 2023-11-11 11:25:07 |
#include<bits/stdc++.h> //#define int long long using namespace std; const int mod = 1e9 + 7; const int maxn = 1e2; int fac[maxn + 5],ifac[maxn + 5]; long long fastpow(long long a,long long b){ long long ans = 1,sum = a; while (b >= 1){ if (b & 1){ ans = (ans * sum) % mod; } sum = (sum * sum) % mod; b >>= 1; } return ans; } inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(long long x){ if (x < 0){ putchar('-'); x = -x; } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } long long C(int a,int b){ return 1LL * fac[a] * ifac[b] % mod * ifac[a - b] % mod; } void slove(){ long long n; n = fr(); n -= 2; fw((long long)(C(2 * n,n) - C(2 * n,n - 1) + mod) % mod); puts(""); return ; } signed main(){ fac[0] = 1; for (int i = 1;i <= maxn;i++){ fac[i] = 1LL * fac[i - 1] * i % mod; } ifac[maxn - 1] = fastpow(fac[maxn - 1],mod - 2); for (int i = maxn - 1;i >= 1;i--){ ifac[i - 1] = 1LL * ifac[i] * i % mod; } long long t = 1; while (t--){ slove(); } return 0; }