結果
問題 | No.73 helloworld |
ユーザー |
![]() |
提出日時 | 2015-06-08 06:01:19 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,730 bytes |
コンパイル時間 | 752 ms |
コンパイル使用メモリ | 96,808 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 14:42:08 |
合計ジャッジ時間 | 1,406 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cstdlib> // require abs exit atof atoi #include <cstdio> // require scanf printf #include <functional> #include <numeric> // require accumulate #include <cmath> // require fabs #include <climits> #include <limits> #include <cfloat> #include <iomanip> // require setw #include <sstream> // require stringstream #include <cstring> // require memset #include <cctype> // require tolower, toupper #include <fstream> // require freopen #include <ctime> // require srand #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() using namespace std; typedef long long ll; typedef pair<int, int> P; ll comb (int n, int r ){ if (n == 0 || r == 0 ) return 0LL; if (n < r ) return 0LL; if (n - r < r ) r = n - r; ll res = 1LL; rep (i, r ) res *= (ll)n, n--; rep (i, r ) res /= (ll)(i+1LL); return res; } int main() { ios_base::sync_with_stdio(0); map<char,int> cnt; cnt.clear(); int in; rep (i, 26 ) cin >> in , cnt[(char)('a' + i ) ] = in; ll res = 1LL; res *= comb (cnt['h'], 1 ); res *= comb (cnt['e'], 1 ); res *= comb (cnt['r'], 1 ); res *= comb (cnt['d'], 1 ); ll currl = 0LL, curro = 0LL, curr = 0LL; for (int suml = 2; suml < cnt['l']; suml++ ){ currl = max (currl, comb (suml, 2 )*comb (cnt['l'] - suml, 1 ) ); for (int sumo = 1; sumo < cnt['o']; sumo++ ){ curro = max (curro, comb (sumo, 1 )*comb (cnt['o'] - sumo, 1 ) ); curr = max (curr, currl*curro ); } // end for } // end for res *= curr; cout << res << endl; return 0; }