結果

問題 No.73 helloworld
ユーザー myanta
提出日時 2017-05-11 22:59:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 37,632 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 01:14:46
合計ジャッジ時間 1,004 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<vector>


using namespace std;
using ll=long long int;


ll nC2(int n)
{
	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, nC2(i)*(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=(ll)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