用户输出
0
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#82007 | #1322. [L2-1]来吃糖果吧 | Accepted | 100 | 29 ms | 500 K | C++ 11 / 986 B | y | 2023-03-10 9:33:50 |
#include <cstdio>
#define N 200009
#define RI register int
#define Max(x, y) ((x) > (y) ? (x) : (y))
using namespace std;
const int P = 1e9 + 7;
int n, aa, bb, ans;
inline int read();
inline int fsq(int x, int tn, int ret = 1) {
while (tn) {
if (tn & 1)
ret = 1ll * ret * x % P;
x = 1ll * x * x % P;
tn >>= 1;
}
return ret;
}
inline void ad(int x) {
int fz = 1, fm = 1;
for (RI i = 1; i <= x; ++i) fm = 1ll * fm * i % P, fz = 1ll * fz * (n - i + 1) % P;
fm = fsq(fm, P - 2);
fz = 1ll * fz * fm % P;
fz = fz ? P - fz : 0;
(ans += fz) %= P;
}
int main() {
n = read();
aa = read(), bb = read();
ans = fsq(2, n);
ad(aa);
ad(bb);
printf("%d\n", ans ? ans - 1 : P - 1);
return 0;
}
inline int read() {
int x = 0, fh = 1;
char c = getchar();
while (c > '9' || c < '0') fh = c == '-' ? -1 : fh, c = getchar();
while (c >= '0' && c <= '9') {
x *= 10;
x += c - '0';
c = getchar();
}
return x * fh;
}
用户输出
382492393
系统信息
Exited with return code 0
用户输出
173776972
系统信息
Exited with return code 0
用户输出
810092880
系统信息
Exited with return code 0
用户输出
506071717
系统信息
Exited with return code 0
用户输出
582594886
系统信息
Exited with return code 0