結果
問題 | No.73 helloworld |
ユーザー |
|
提出日時 | 2016-11-26 18:51:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 747 bytes |
コンパイル時間 | 1,599 ms |
コンパイル使用メモリ | 167,428 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 20:35:35 |
合計ジャッジ時間 | 1,839 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;signed main(){vector< int > cnt( 256 );for( int i = 'a'; i <= 'z'; ++i )cin >> cnt[ i ];if( cnt[ 'h' ] < 1 or cnt[ 'e' ] < 1 or cnt[ 'l' ] < 3 or cnt[ 'o' ] < 2 or cnt[ 'w' ] < 1 or cnt[ 'r' ] < 1 or cnt[ 'd' ] < 1 )cout << 0 << endl, exit( 0 );ll ans = 1;ans *= cnt[ 'h' ];ans *= cnt[ 'e' ];ans *= cnt[ 'w' ];ans *= cnt[ 'r' ];ans *= cnt[ 'd' ];ll x = 0;for( int i = 2; cnt[ 'l' ] - i >= 1; ++i ){x = max( x, 1LL * ( cnt[ 'l' ] - i ) * i * ( i - 1 ) / 2 );}ans *= x;x = 0;for( int i = 1; cnt[ 'o' ] - i >= 1; ++i ){x = max( x, 1LL * i * ( cnt[ 'o' ] - i ) );}ans *= x;cout << ans << endl;return 0;}