問題一覧 > 通常問題

No.933 Officer, It's This Guy

レベル : / AI推定難易度 : 600 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 269
作問者 : leafirby / テスター : null
お気に入りにしたユーザー ProblemId : 3380 / 自分の提出
問題文最終更新日: 2019-12-01 01:05:13
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 232 (順位表) の他の問題:

Problem Statement

Iot-kun found a girl made up of $N$ non-negative integers in a park.
Since the chance has come up, let's tell Iot-kun the age of the girl he found.
The age of the girl is defined as follows.
Among the numbers that make up the girl, let the $i$-th one be $P_i$.
Let $P_1×P_2×...×P_N=K$. Then, the value of $K$ after the following operation is the girl's age.
Operation: $K$=the sum of the digits of $K$ (repeated as long as the number of digits of $K$ $\neq 1$)

Input

$N$
$P_1$ $P_2$ $...$ $P_N$

$0 < N\le 10^5$
$0\le P_i\le 10^{18}$

Output

Output the girl's age, followed by a newline.

Sample

Sample 1
Input
5  
1 1 2 5 14
Output
5

$K=1×1×2×5×14=140$, and the sum of its digits is $5$.
Since $K$ now has 1 digit, the girl is $5$ years old.

Sample 2
Input
1
95685
Output
6

$K=95685$, and the sum of its digits is $33$, so after the first operation $K=33$.
The second operation gives $K=3+3=6$, which has 1 digit, so the girl is $6$ years old. That's illegal, isn't it.

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