結果
問題 | No.895 MESE |
ユーザー |
![]() |
提出日時 | 2023-11-29 12:05:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 219 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 82,720 KB |
実行使用メモリ | 87,040 KB |
最終ジャッジ日時 | 2024-09-26 13:21:39 |
合計ジャッジ時間 | 5,112 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
a, b, c = map(int, input().split()) mod = 10 ** 9 + 7 n = 5*10**5+5 fact = [1] * (n + 1) invfact = [1] * (n + 1) for i in range(1, n): fact[i + 1] = ((i+1) * fact[i]) % mod invfact[n] = pow(fact[n], mod - 2, mod) for i in range(n - 1, -1, -1): invfact[i] = invfact[i + 1] * (i + 1) % mod def comb(n, r): if n < 0 or r < 0 or n - r < 0: return 0 return fact[n] * invfact[r] * invfact[n - r] % mod N = a + b + c ans = 0 for i in range(1, N - 1): na = a - (N - i - 1) nb = b - 1 if na < 0: continue ans += comb(na + nb + c, na) * comb(nb + c, nb) * c * (pow(2, i, mod) - 1) * pow(i, mod - 2, mod) ans %= mod print(ans)