結果

問題 No.895 MESE
ユーザー 👑 jupirojupiro
提出日時 2019-10-01 21:13:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 1,568 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 90,488 KB
実行使用メモリ 15,824 KB
最終ジャッジ日時 2024-04-14 08:40:22
合計ジャッジ時間 3,402 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
15,644 KB
testcase_01 AC 18 ms
15,552 KB
testcase_02 AC 19 ms
15,824 KB
testcase_03 AC 17 ms
15,744 KB
testcase_04 AC 18 ms
15,688 KB
testcase_05 AC 19 ms
15,688 KB
testcase_06 AC 18 ms
15,628 KB
testcase_07 AC 17 ms
15,568 KB
testcase_08 AC 17 ms
15,688 KB
testcase_09 AC 17 ms
15,736 KB
testcase_10 AC 18 ms
15,660 KB
testcase_11 AC 18 ms
15,504 KB
testcase_12 AC 19 ms
15,688 KB
testcase_13 AC 42 ms
15,664 KB
testcase_14 AC 79 ms
15,676 KB
testcase_15 AC 84 ms
15,516 KB
testcase_16 AC 58 ms
15,668 KB
testcase_17 AC 25 ms
15,728 KB
testcase_18 AC 93 ms
15,524 KB
testcase_19 AC 91 ms
15,800 KB
testcase_20 AC 90 ms
15,728 KB
testcase_21 AC 92 ms
15,780 KB
testcase_22 AC 92 ms
15,700 KB
testcase_23 AC 91 ms
15,676 KB
testcase_24 AC 93 ms
15,684 KB
testcase_25 AC 93 ms
15,680 KB
testcase_26 AC 91 ms
15,776 KB
testcase_27 AC 92 ms
15,640 KB
testcase_28 AC 92 ms
15,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 510000;
const long long INF = 1LL << 60;
const long long MOD = 1000000007LL;

using namespace std;
typedef unsigned long long ull;
typedef  long long ll;

long long fac[MAX], finv[MAX], inv[MAX];

ll power(ll x, ll n, ll p = 1000000007) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return power(x * x % p, n / 2, p) % p;
	}
	else {
		return x * power(x, n - 1, p) % p;
	}
}

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;
	}
}

ll 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 main()
{
	COMinit();
	ll a, b, c;
	scanf("%lld %lld %lld", &a, &b, &c);
	ll res = 0;
	ll N = a + b + c;
	for (ll i = 1; i <= a; i++) {
		res += COM(N - i - 2, c - 1) * COM(N - i - c - 1, b - 1) % MOD * (((power(2, N - i - 1, MOD) - 1) % MOD + MOD) % MOD) % MOD;
		res %= MOD;
	}

	printf("%lld\n", res);
	return 0;
}
0