結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
nanasili
|
| 提出日時 | 2014-11-21 00:22:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,402 bytes |
| コンパイル時間 | 1,145 ms |
| コンパイル使用メモリ | 85,572 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 19:41:28 |
| 合計ジャッジ時間 | 1,517 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 2 |
ソースコード
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>
#include <cstring>
using namespace std;
typedef long long ll;
ll memo[101][101];
ll combi(ll a, ll b) {
if (b == 1) return a;
if (a == b) return 1;
if (memo[a][b]) return memo[a][b];
return memo[a][b]=combi(a-1, b-1)+combi(a-1, b);
}
int main() {
ll alnum['z'-'a'+1];
memset(alnum, 0, sizeof(alnum));
for (int i = 0; i < 'z'-'a'+1; i++) cin >> alnum[i];
string str = "helowrd";
ll num[] = {1,1,2,1,1,1,1};
ll ans = 0;
ll t = 1;
bool ok = true;
for (int i = 0; i < str.size(); i++) {
if (alnum[str[i]-'a'] >= num[i]) {
if (str[i] != 'l' && str[i] != 'o') {
t *= combi(alnum[str[i]-'a'], num[i]);
}
}else {
ok = false;
ans = 0;
break;
}
}
if (t && ok) ans = 1;
for (ll i = alnum['l'-'a']-2; i >= 1; i--) {
for (ll j = alnum['o'-'a']-1; j >= 1; j--) {
// cerr << alnum['l'-'a']-i << " " << i << " " << alnum['o'-'a']-j << " " << j << endl;
ans = max(t*combi(alnum['l'-'a']-i, 2)*combi(i, 1)*combi(alnum['o'-'a']-j, 1)*combi(j, 1), ans);
}
}
cout << ans << endl;
}
nanasili