結果

問題 No.933 おまわりさんこいつです
ユーザー GrayCoderGrayCoder
提出日時 2019-11-29 22:43:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 598 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 88,248 KB
最終ジャッジ日時 2023-08-13 06:45:24
合計ジャッジ時間 9,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,440 KB
testcase_01 AC 105 ms
72,516 KB
testcase_02 AC 106 ms
72,488 KB
testcase_03 AC 105 ms
72,536 KB
testcase_04 AC 105 ms
72,424 KB
testcase_05 AC 105 ms
72,528 KB
testcase_06 AC 105 ms
72,372 KB
testcase_07 AC 105 ms
72,372 KB
testcase_08 AC 105 ms
72,284 KB
testcase_09 AC 104 ms
72,508 KB
testcase_10 AC 105 ms
72,432 KB
testcase_11 AC 110 ms
76,704 KB
testcase_12 AC 111 ms
76,764 KB
testcase_13 AC 118 ms
77,584 KB
testcase_14 AC 122 ms
77,656 KB
testcase_15 AC 153 ms
77,552 KB
testcase_16 AC 535 ms
80,660 KB
testcase_17 AC 142 ms
85,612 KB
testcase_18 AC 106 ms
72,404 KB
testcase_19 AC 157 ms
88,248 KB
testcase_20 AC 1,674 ms
87,192 KB
testcase_21 AC 106 ms
72,400 KB
testcase_22 AC 107 ms
72,288 KB
testcase_23 TLE -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
from operator import mul
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    P = map(int, input().split())

    def func(n):
        d, ret = 1, 0
        while 1:
            while d > 0:
                d, m = divmod(n, 10)
                ret += m
                n = d
            if ret < 10:
                return ret
            d, n = 1, ret
            ret = 0

    p = [func(i) for i in P]
    k = reduce(mul, p)
    ans = 10
    while ans > 9:
        ans = func(k)
        k = ans
    print(ans)


main()
0