結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー rin204
提出日時 2021-07-30 20:59:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-09-15 22:48:51
合計ジャッジ時間 4,432 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt = [0] + list(map(int, input().split()))
if n == 1:
    for i, c in enumerate(cnt):
        if c == 1:
            print(i)
            exit()
            
tot = 0
two = 8
five = 5
seven = 7
for i, c in enumerate(cnt):
    tot += i * c
    if c > 0:
        if i == 8:
            pass
        elif i == 4:
            two = min(two, 4)
        elif i == 2:
            two = min(two, 2)
        else:
            two = 1
        if i != 5:
            five = 1
        if i != 7:
            seven = 1
        
ans = two * five * seven
if tot % 9 == 0:
    ans *= 9
elif tot % 3 == 0:
    ans *= 3
print(ans)
0