結果

問題 No.73 helloworld
ユーザー dnishdnish
提出日時 2018-06-18 10:10:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 979 bytes
コンパイル時間 1,570 ms
コンパイル使用メモリ 171,976 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 06:41:57
合計ジャッジ時間 2,542 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll inf=1e18;

map<char, ll> m;
ll ans;
int main(){

    for(char c='a';c<='z';c++){
        int a;
        cin>>a;
        m[c]=a;
    }
    string s="helowrd";
    ans=1;
    for(auto c:s){
        if(c=='l') {
            ll mx=0;
            REP(i,0,m[c]+1) {
                ll tmp=1;
                ll a = i;
                ll b = m[c] - a;
                tmp *= a;
                tmp *= b * (b - 1) / 2;
                mx = max(mx, tmp);
            }
            ans*=mx;
        }else if(c=='o'){
            ll a=m[c]/2;
            ll b=m[c]-a;
            ans*=a;
            ans*=b;
        }
        else ans*=m[c];
    }
    p(ans);
    return 0;
}
0