結果

問題 No.895 MESE
ユーザー Ogtsn99Ogtsn99
提出日時 2019-10-01 11:00:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,380 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 164,656 KB
実行使用メモリ 15,728 KB
最終ジャッジ日時 2024-04-14 08:31:00
合計ジャッジ時間 3,212 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
15,516 KB
testcase_01 AC 16 ms
15,364 KB
testcase_02 AC 16 ms
15,460 KB
testcase_03 AC 16 ms
15,532 KB
testcase_04 AC 16 ms
15,536 KB
testcase_05 AC 16 ms
15,728 KB
testcase_06 AC 17 ms
15,440 KB
testcase_07 AC 17 ms
15,492 KB
testcase_08 AC 16 ms
15,436 KB
testcase_09 AC 16 ms
15,436 KB
testcase_10 AC 17 ms
15,468 KB
testcase_11 AC 17 ms
15,388 KB
testcase_12 AC 17 ms
15,496 KB
testcase_13 AC 20 ms
15,492 KB
testcase_14 AC 26 ms
15,416 KB
testcase_15 AC 27 ms
15,420 KB
testcase_16 AC 22 ms
15,364 KB
testcase_17 AC 19 ms
15,524 KB
testcase_18 AC 27 ms
15,468 KB
testcase_19 AC 28 ms
15,544 KB
testcase_20 AC 27 ms
15,508 KB
testcase_21 AC 27 ms
15,480 KB
testcase_22 AC 28 ms
15,560 KB
testcase_23 AC 27 ms
15,376 KB
testcase_24 AC 27 ms
15,532 KB
testcase_25 AC 27 ms
15,388 KB
testcase_26 AC 26 ms
15,536 KB
testcase_27 AC 27 ms
15,588 KB
testcase_28 AC 27 ms
15,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int power(int x, int n) {
  int ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= MOD;
    (x *= x) %= MOD;
    n >>= 1;
  }
  return ret;
}
signed main(void){
    int a,b,c; cin>>a>>b>>c;
    COMinit();
    int ans = 0;
    for(int i=1;i<=a;i++){
        ans += COM(a+b+c-i-2, c-1)*COM(a+b-i-1, b-1)%MOD * (power(2, a+b+c-i-1)-1)%MOD;
        ans %= MOD;
    }
    cout<<ans<<endl;
}
0