結果
問題 | No.895 MESE |
ユーザー | kotamanegi |
提出日時 | 2019-09-27 21:46:27 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 2,076 bytes |
コンパイル時間 | 1,028 ms |
コンパイル使用メモリ | 112,556 KB |
実行使用メモリ | 11,396 KB |
最終ジャッジ日時 | 2023-08-20 12:58:02 |
合計ジャッジ時間 | 4,543 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
11,324 KB |
testcase_01 | AC | 67 ms
11,276 KB |
testcase_02 | AC | 66 ms
11,332 KB |
testcase_03 | AC | 65 ms
11,336 KB |
testcase_04 | AC | 65 ms
11,336 KB |
testcase_05 | AC | 66 ms
11,220 KB |
testcase_06 | AC | 66 ms
11,288 KB |
testcase_07 | AC | 64 ms
11,252 KB |
testcase_08 | AC | 65 ms
11,328 KB |
testcase_09 | AC | 66 ms
11,336 KB |
testcase_10 | AC | 67 ms
11,396 KB |
testcase_11 | AC | 65 ms
11,336 KB |
testcase_12 | AC | 64 ms
11,236 KB |
testcase_13 | AC | 71 ms
11,204 KB |
testcase_14 | AC | 88 ms
11,396 KB |
testcase_15 | AC | 90 ms
11,320 KB |
testcase_16 | AC | 78 ms
11,204 KB |
testcase_17 | AC | 69 ms
11,204 KB |
testcase_18 | AC | 88 ms
11,284 KB |
testcase_19 | AC | 91 ms
11,256 KB |
testcase_20 | AC | 90 ms
11,236 KB |
testcase_21 | AC | 91 ms
11,316 KB |
testcase_22 | AC | 90 ms
11,236 KB |
testcase_23 | AC | 88 ms
11,260 KB |
testcase_24 | AC | 89 ms
11,336 KB |
testcase_25 | AC | 93 ms
11,288 KB |
testcase_26 | AC | 89 ms
11,204 KB |
testcase_27 | AC | 89 ms
11,252 KB |
testcase_28 | AC | 89 ms
11,272 KB |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include <random> #include<map> #include <iomanip> #include <time.h> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <set> #include <cassert> #include<fstream> #include <unordered_map> #include <cstdlib> #include <complex> #include <cctype> #include <bitset> using namespace std; typedef string::const_iterator State; #define Ma_PI 3.141592653589793 #define eps 1e-5 #define LONG_INF 1000000000000000000LL #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007LL #define GYAKU 500000004LL #define MOD 998244353LL #define seg_size 262144*4 #define REP(a,b) for(long long a = 0;a < b;++a) long long powing(long long now, long long b) { long long ans = 1; while (b != 0) { if (b % 2) { ans *= now; ans %= MAX_MOD; } b /= 2; now *= now; now %= MAX_MOD; } return ans; } long long inv(long long now) { return powing(now, MAX_MOD - 2LL); } long long mae[500000]; long long gyaku[500000]; long long comb(long long a, long long b) { long long ans = mae[b]; ans *= gyaku[a]; ans %= MAX_MOD; ans *= gyaku[b - a]; ans %= MAX_MOD; return ans; } int main() { mae[0] = 1; gyaku[0] = 1; for (long long i = 1; i < 500000; ++i) { mae[i] = mae[i - 1] * i; mae[i] %= MAX_MOD; gyaku[i] = inv(mae[i]); } long long a, b, c; cin >> a >> b >> c; a--; b--; long long ans = 0; while (a != -1) { //Choose B and starting! //期待値ゲー long long percent = c * inv(a + b + c); // cを選ぶ確率 long long toori = (comb(a, a + b + c) * comb(b, b + c)) % MAX_MOD;//通り数 long long tmp = (powing(2LL, a + b + c) + MAX_MOD - 1LL) % MAX_MOD; percent %= MAX_MOD; ans += (((percent * toori) % MAX_MOD) * tmp) % MAX_MOD; ans %= MAX_MOD; //choose A and continue a--; } cout << ans << endl; return 0; }