結果

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

ソースコード

diff #

MOD = 10 ** 9 + 7

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(i * (pow(10, n, MOD) - 1) * pow(9, MOD - 2, MOD) % MOD)
        exit()
    tot += i * c
    if c > 0:
        if i == 8:
            pass
        elif i == 4:
            two = min(two, 4)
        elif i % 2 == 0:
            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