結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー PSL24251284
提出日時 2021-07-31 00:29:08
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 615 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 67,376 KB
最終ジャッジ日時 2024-09-16 04:24:37
合計ジャッジ時間 4,410 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 RE * 1
other AC * 34 WA * 21 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N = int(input())
c = [0] + list(map(int,input().split()))
for i in range(10):
    if c[i] == N:
        ans = pow(10,N,mod)-1
        ans *= pow(9,mod-2,mod)
        ans %= mod
        ans *= i
        ans %= mod
        print(ans)
        exit()
        
x = 0
for i in range(10):
    x += (c[i]%9)*i
x %= 9
if x == 3 or x == 6:
    ans = 3
elif x == 0:
    ans = 9
else:
    ans = 1
g = 0
for i in range(10):
    for j in range(10):
        if i != j and c[i] >= 1 and c[j] >= 1:
            t = i-j
            while t%3 == 0:
                t //= 3
            g = math.gcd(g,t)
ans *= g
print(ans)
0