結果

問題 No.933 おまわりさんこいつです
ユーザー GrayCoderGrayCoder
提出日時 2019-11-29 22:40:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 598 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 20,648 KB
最終ジャッジ日時 2024-05-01 00:39:22
合計ジャッジ時間 6,450 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 25 ms
10,880 KB
testcase_04 AC 25 ms
10,752 KB
testcase_05 AC 25 ms
10,752 KB
testcase_06 AC 25 ms
10,624 KB
testcase_07 AC 25 ms
10,752 KB
testcase_08 AC 25 ms
10,752 KB
testcase_09 AC 25 ms
10,880 KB
testcase_10 AC 24 ms
10,624 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 27 ms
10,752 KB
testcase_13 AC 30 ms
10,880 KB
testcase_14 AC 34 ms
10,880 KB
testcase_15 AC 51 ms
11,392 KB
testcase_16 AC 200 ms
12,748 KB
testcase_17 AC 134 ms
16,540 KB
testcase_18 AC 26 ms
10,624 KB
testcase_19 AC 162 ms
17,464 KB
testcase_20 AC 614 ms
12,648 KB
testcase_21 AC 26 ms
10,752 KB
testcase_22 AC 24 ms
10,752 KB
testcase_23 AC 1,421 ms
20,520 KB
testcase_24 TLE -
権限があれば一括ダウンロードができます

ソースコード

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