結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー rin204
提出日時 2021-07-30 21:00:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-09-15 21:26:59
合計ジャッジ時間 8,303 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 19 OLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt = [0] + list(map(int, input().split()))
tot = 0
two = 8
five = 5
seven = 7
for i, c in enumerate(cnt):
    if c == n:
        print(str(i) * n)
        exit()
    
    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