結果

問題 No.73 helloworld
ユーザー myantamyanta
提出日時 2017-05-11 22:58:01
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 37,504 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 08:08:19
合計ジャッジ時間 1,031 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<vector>


using namespace std;
using ll=long long int;


ll nCr(int n, int r)
{
	return (ll)n*(n-1)/2;
}


ll l_max_calc(int n)
{
	ll ret=0;

	for(int i=2;i+1<=n;i++)
	{
		ret=max(ret, nCr(i, 2)*(n-i));
	}
	return ret;
}


int main(void)
{
	vector<int> c;
	int o_num, l_num;
	ll ans;

	for(;;)
	{
		c.clear();
		c.resize(26);
		// hello world
		for(int i=0;i<26;i++)
		{
			if(scanf("%d", &c[i])!=1) return 0;
		}
		ans=c['h'-'a']*c['e'-'a']*c['w'-'a']*c['r'-'a']*c['d'-'a'];
		o_num=c['o'-'a'];
		ans*=(o_num/2)*(o_num-o_num/2);
		l_num=c['l'-'a'];
		ans*=l_max_calc(l_num);

		printf("%lld\n", ans);
	}

	return 0;
}
0