結果

問題 No.933 おまわりさんこいつです
ユーザー neterukunneterukun
提出日時 2019-11-29 23:17:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 94,228 KB
最終ジャッジ日時 2023-08-13 06:52:27
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,572 KB
testcase_01 AC 70 ms
71,316 KB
testcase_02 AC 71 ms
71,116 KB
testcase_03 AC 72 ms
71,248 KB
testcase_04 AC 71 ms
71,496 KB
testcase_05 AC 73 ms
71,344 KB
testcase_06 AC 73 ms
71,092 KB
testcase_07 AC 71 ms
71,240 KB
testcase_08 AC 69 ms
71,100 KB
testcase_09 AC 69 ms
71,604 KB
testcase_10 AC 70 ms
71,304 KB
testcase_11 AC 70 ms
71,340 KB
testcase_12 AC 72 ms
71,456 KB
testcase_13 AC 76 ms
76,400 KB
testcase_14 AC 77 ms
76,572 KB
testcase_15 AC 78 ms
76,548 KB
testcase_16 AC 84 ms
79,812 KB
testcase_17 AC 90 ms
86,668 KB
testcase_18 AC 69 ms
71,300 KB
testcase_19 AC 94 ms
90,176 KB
testcase_20 AC 92 ms
89,128 KB
testcase_21 AC 69 ms
71,476 KB
testcase_22 AC 71 ms
71,304 KB
testcase_23 AC 106 ms
94,228 KB
testcase_24 AC 101 ms
93,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(n):
    if p[i] % 9 == 0:
        cnt += 2
    elif p[i] % 3 == 0:
        cnt += 1
    if p[i] == 0:
        print(0)
        exit()
if cnt >= 2:
    print(9)
    exit()
    
n = len(p)
while True:
    tmp = []
    if len(p) % 2 == 1:
        tmp.append(p[-1])
    for i in range(n//2):
        tmp.append(p[2*i]*p[2*i+1])
    p = tmp[0:]
    n = len(p)
    if n == 1:
        ans = p[0]
        break

while True:
    if len(str(ans)) == 1:
        print(ans)
        break
    tmp = 0
    for i in str(ans):
        tmp += int(i)
    ans = tmp
0