結果

問題 No.933 おまわりさんこいつです
ユーザー FromBooskaFromBooska
提出日時 2023-09-21 20:20:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 93,852 KB
最終ジャッジ日時 2023-09-21 20:20:18
合計ジャッジ時間 4,905 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,256 KB
testcase_01 AC 72 ms
71,596 KB
testcase_02 AC 74 ms
71,492 KB
testcase_03 AC 75 ms
71,220 KB
testcase_04 AC 74 ms
71,148 KB
testcase_05 AC 75 ms
71,064 KB
testcase_06 AC 73 ms
71,304 KB
testcase_07 AC 73 ms
71,304 KB
testcase_08 AC 72 ms
71,316 KB
testcase_09 AC 74 ms
71,220 KB
testcase_10 AC 75 ms
71,224 KB
testcase_11 AC 77 ms
75,788 KB
testcase_12 AC 80 ms
75,708 KB
testcase_13 AC 84 ms
76,484 KB
testcase_14 AC 88 ms
76,660 KB
testcase_15 AC 91 ms
77,024 KB
testcase_16 AC 104 ms
80,160 KB
testcase_17 AC 126 ms
86,928 KB
testcase_18 AC 74 ms
71,188 KB
testcase_19 AC 139 ms
90,436 KB
testcase_20 AC 159 ms
89,428 KB
testcase_21 AC 75 ms
71,388 KB
testcase_22 AC 77 ms
71,220 KB
testcase_23 AC 162 ms
93,780 KB
testcase_24 AC 165 ms
93,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# Pi<10**18の多数の掛け算の桁和
# 筆算を考えれば、1つの数字の全桁の数*もう1つの数字の全桁の数
# 全組合せということは、1つの数字の桁和*もう1つの数字の桁和でも同じか
# やってみる

N = int(input())
P = list(map(int, input().split()))

def digit_sum(num):
    s = 0
    for n in str(num):
        s += int(n)
    return s

prod = 1
for i in range(N):
    prod *= digit_sum(P[i])
    prod = digit_sum(prod)
    #print(prod)

while prod >= 10:
    prod = digit_sum(prod)
print(prod)



0