結果

問題 No.73 helloworld
コンテスト
ユーザー kyuna
提出日時 2019-08-11 12:29:25
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 468µs
コード長 613 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 497 ms
コンパイル使用メモリ 97,880 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-26 04:31:48
合計ジャッジ時間 1,732 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
    map<char, int> cnt;
    cnt[' '] = 1;
    for (char c = 'a'; c <= 'z'; c++) cin >> cnt[c];
    long long ans = 1;
    for (char c: "hewrd") if (c) ans *= cnt[c];
    int ma_l = 0;
    for (int i = 2; i < cnt['l']; i++) {
        int tmp = (i * (i - 1) / 2) * (cnt['l'] - i);
        ma_l = max(ma_l, tmp);
    }
    int ma_o = 0;
    for (int i = 1; i < cnt['o']; i++) {
        int tmp = i * (cnt['o'] - i);
        ma_o = max(ma_o, tmp);
    }
    cout << ans * ma_l * ma_o << endl;
    return 0;
}
0