問題一覧 > 通常問題

No.73 helloworld

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 242
作問者 : shimomire
お気に入りにしたユーザー ProblemId : 144 / 自分の提出
問題文最終更新日: 2026-06-26 03:54:11
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 55 (順位表) の他の問題:

Problem Statement

(Problem statement corrected on 2014/11/26 2:35.)

A-kun loves helloworld more than anything. The helloworld number of a string S is defined as the number of tuples $(i_0,\cdots,i_9)$ satisfying the following.

  1. $S[i_0]S[i_1] \cdots S[i_9]="helloworld"$
  2. $i_0 < i_1 < \cdots < i_9$
Given the count of each letter of the alphabet, find the maximum helloworld number among strings that can be made using each letter exactly that many times.

Input

$C_a$
$C_b$
$\cdots$
$C_z$

$C_{alpha}(0 \le C_{alpha} \le 100)$ represents the count of the letter $alpha$.

Output

Print on one line the maximum helloworld number A-kun can obtain. Print a newline at the end of the output.

Sample

Sample 1
Input
0
0
0
1
1
0
0
1
0
0
0
3
0
0
2
0
0
1
0
0
0
0
1
0
0
0
Output
1

The available letters are as follows.
1 of "d"
1 of "e"
1 of "h"
3 of "l"
2 of "o"
1 of "r"
1 of "w"

Arranging them as "helloworld" gives a helloworld number of 1.

Sample 2
Input
0
0
0
1
1
0
0
1
0
0
0
4
0
0
3
0
0
1
0
0
0
0
1
0
0
0
Output
6

The available letters are as follows.
1 of "d"
1 of "e"
1 of "h"
4 of "l"
3 of "o"
1 of "r"
1 of "w"

For example, if arranged as "hellooworldl",
there are the following 2 ways, depending on whether the "o" of hello uses the 4th or the 5th character.
(0,1,2,3,4,6,7,8,9,10)
(0,1,2,3,5,6,7,8,9,10)
For this input, the maximum helloworld number is obtained by arranging them as, for example, "helllowoorld".

Sample 3
Input
0
0
0
1
1
0
0
1
0
0
0
99
0
0
2
0
0
1
0
0
0
0
1
0
0
0
Output
70785

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。