No.73 helloworld
タグ : / 解いたユーザー数 242
作問者 :
shimomire
Problem Statement
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.
- $S[i_0]S[i_1] \cdots S[i_9]="helloworld"$
- $i_0 < i_1 < \cdots < i_9$
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もしくは右上の雲マークをクリックしてアカウントを作成してください。