結果
| 問題 | 
                            No.73 helloworld
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ty70
                         | 
                    
| 提出日時 | 2015-06-08 05:47:42 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,773 bytes | 
| コンパイル時間 | 739 ms | 
| コンパイル使用メモリ | 96,972 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-06 14:42:07 | 
| 合計ジャッジ時間 | 1,412 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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 );
	
	if (cnt['l'] != 3 ){
		ll curr = 0LL;
		for (int sum = 2; sum <= cnt['l'] - 1; sum++ ){
			curr = max (curr, comb (sum, 2 )*comb (cnt['l'] - sum, 1 ) );
		} // end for
		res *= curr;
	} // end if
	if (cnt['o'] != 2 ){
		ll curr = 0LL;
		for (int sum = 1; sum <= cnt['o'] - 1; sum++ ){
			curr = max (curr, comb (sum, 1 )*comb (cnt['o'] - sum, 1 ) );
		} // end for
		res *= curr;
	} // end if
	
	cout << res << endl;		
	return 0;
}
            
            
            
        
            
ty70