結果

問題 No.73 helloworld
ユーザー face4face4
提出日時 2018-05-13 16:53:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 995 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 65,116 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 19:03:48
合計ジャッジ時間 1,201 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int A[26];
    for(int i = 0; i < 26; i++)  cin >> A[i];

    long long ans = 1;
    if(A['d'-'a'] > 0)  ans *= A['d'-'a'];
    else                ans = 0;
    if(A['e'-'a'] > 0)  ans *= A['e'-'a'];
    else                ans = 0;
    if(A['h'-'a'] > 0)  ans *= A['h'-'a'];
    else                ans = 0;
    if(A['r'-'a'] > 0)  ans *= A['r'-'a'];
    else                ans = 0;
    if(A['w'-'a'] > 0)  ans *= A['w'-'a'];
    else                ans = 0;
    if(A['o'-'a'] > 1)  ans *= (A['o'-'a']/2*(A['o'-'a']-A['o'-'a']/2));
    else                ans = 0;
    if(A['l'-'a'] > 2){
        int num = A['l'-'a'];
        num -= 3;
        int light = 2, right = 1;
        int ma = 0;
        for(int i = 0; i <= num; i++){
            int l = light+i;
            int r = right+num-i;
            ma = max(ma, l*(l-1)/2*r);
        }

        ans *= ma;
    }else{
        ans = 0;
    }

    cout << ans << endl;
    return 0;
}
0