結果

問題 No.73 helloworld
ユーザー lapilapi
提出日時 2019-07-07 18:55:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,153 bytes
コンパイル時間 1,149 ms
コンパイル使用メモリ 106,084 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 10:38:42
合計ジャッジ時間 1,732 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <cmath>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

ll C[26];

// aCb
ll comb(ll a, ll b) {
	ll res = 1;
	for (ll i = 0; i < b; i++) res *= (a - i);
	for (ll i = 1; i <= b; i++) res /= i;
	//cout << res << " ";
	return res;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	for (int i = 0; i < 26; i++) cin >> C[i];

	if (C[3] > 0 && C[4] > 0 && C[7] > 0 && C[11] > 2 && C[14] > 1 && C[17] > 0 && C[22] > 0) {
		//cout << "ok" << endl;

		ll ans = 1;
		ans *= C[3];
		ans *= C[4];
		ans *= C[7];

		ll res = 1;
		for (ll i = 2; i < C[11]; i++) {
			ll tmp = comb(i, 2)*(C[11] - i);
			res = max(res, tmp);
		}
		ans *= res;
		//cout << res << " ";

		ans *=( C[14] / 2*(C[14] - C[14] / 2));
		ans *= C[17];
		ans *= C[22];

		cout << ans << endl;
	}
	else cout << 0 << endl;


	return 0;
}
0