結果

問題 No.933 おまわりさんこいつです
ユーザー FromBooska
提出日時 2023-03-09 13:47:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,088 KB
実行使用メモリ 93,184 KB
最終ジャッジ日時 2024-09-18 02:53:19
合計ジャッジ時間 3,044 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

# 入力例2の言葉はいけない
# 難しいのは最初の掛け算だけ、あとは簡単
# 解き方が思いつかないので実験してみた
# かける数字同士の各桁をかけた和を使えばいいか

N = int(input())
P = list(map(int, input().split()))
product = P[0]

for i in range(1, N):
    list1 = []
    for p1 in str(product):
        list1.append(int(p1))
    list2 = []
    for p2 in str(P[i]):
        list2.append(int(p2))
    product = 0
    for p1 in list1:
        for p2 in list2:
            product += p1*p2
#print(product)

while True:
    temp = 0
    for s in str(product):
        temp += int(s)
    #print(temp)
    if len(str(temp)) == 1:
        break
    else:
        product = temp
    
print(temp)
0