結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
data9824
|
| 提出日時 | 2015-06-07 14:51:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,248 bytes |
| コンパイル時間 | 419 ms |
| コンパイル使用メモリ | 57,668 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 02:03:29 |
| 合計ジャッジ時間 | 1,074 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
unsigned long long combination(unsigned long long n, unsigned long long m) {
if (n < m) {
return 0;
}
unsigned long long smaller = min(m, n - m);
unsigned long long larger = max(m, n - m);
unsigned long long numerator = 1;
for (unsigned long long x = n; x > larger; --x) {
numerator *= x;
}
unsigned long long denominator = 1;
for (unsigned long long x = smaller; x > 0; --x) {
denominator *= x;
}
return numerator / denominator;
}
int main() {
int c[26];
for (int i = 0; i < 26; ++i) {
cin >> c[i];
}
unsigned long long maxCount = 0;
for (int formerL = 2; formerL < c['l' - 'a']; ++formerL) {
for (int formerO = 1; formerO < c['o' - 'a']; ++formerO) {
unsigned long long count = 1;
count *= combination(c['h' - 'a'], 1);
count *= combination(c['e' - 'a'], 1);
count *= combination(formerL, 2);
count *= combination(formerO, 1);
count *= combination(c['w' - 'a'], 1);
count *= combination(c['o' - 'a'] - formerO, 1);
count *= combination(c['r' - 'a'], 1);
count *= combination(c['l' - 'a'] - formerL, 1);
count *= combination(c['d' - 'a'], 1);
maxCount = max(maxCount, count);
}
}
cout << maxCount << endl;
return 0;
}
data9824