結果

問題 No.933 おまわりさんこいつです
ユーザー calei
提出日時 2020-01-07 23:35:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 642 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,524 KB
最終ジャッジ日時 2024-11-23 01:21:36
合計ジャッジ時間 3,196 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

# 2020/01/07
# 解説カンニング
# 数字根の性質を利用する
#  n==0のとき => 0
#  n%9==0のとき => 9
#  else => n%9

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

cnt=1
for e in p:
    tmp=e%9
    if tmp:
        cnt*=tmp
    else:
        if e:
            cnt*=9
        else:
            print(0)
            exit()
ans=cnt%9 if cnt%9 else 9

print(ans)
0