結果

問題 No.933 おまわりさんこいつです
ユーザー neterukunneterukun
提出日時 2019-11-29 23:14:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 89,000 KB
最終ジャッジ日時 2024-05-01 00:46:45
合計ジャッジ時間 2,238 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,152 KB
testcase_01 AC 36 ms
52,420 KB
testcase_02 AC 37 ms
52,300 KB
testcase_03 AC 37 ms
52,988 KB
testcase_04 AC 36 ms
52,484 KB
testcase_05 AC 36 ms
52,140 KB
testcase_06 AC 36 ms
52,988 KB
testcase_07 AC 36 ms
52,260 KB
testcase_08 AC 36 ms
52,092 KB
testcase_09 AC 40 ms
53,412 KB
testcase_10 AC 36 ms
53,520 KB
testcase_11 AC 37 ms
52,620 KB
testcase_12 AC 37 ms
53,948 KB
testcase_13 AC 40 ms
58,424 KB
testcase_14 AC 40 ms
58,944 KB
testcase_15 AC 40 ms
61,896 KB
testcase_16 AC 45 ms
65,968 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 54 ms
76,936 KB
testcase_21 AC 35 ms
53,136 KB
testcase_22 AC 35 ms
53,152 KB
testcase_23 AC 65 ms
88,736 KB
testcase_24 AC 67 ms
89,000 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 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