結果
問題 | No.1632 Sorting Integers (GCD of M) |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:06:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 763 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 82,648 KB |
実行使用メモリ | 54,376 KB |
最終ジャッジ日時 | 2025-03-20 21:06:44 |
合計ジャッジ時間 | 3,734 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 WA * 16 |
ソースコード
import mathMOD = 10**9 + 7n = int(input())c = list(map(int, input().split()))count_nonzero = 0digit = -1for i in range(9):if c[i] > 0:count_nonzero += 1digit = i + 1if count_nonzero == 1:d = digitK = 9 * MODpow10n = pow(10, n, K)pow10n_minus_1 = (pow10n - 1) % Ks = pow10n_minus_1 // 9res = (d * s) % MODprint(res)else:factors = 1all_even = Truefor idx in [0, 2, 4, 6, 8]:if c[idx] != 0:all_even = Falsebreakif all_even:factors *= 2if c[4] == n:factors *= 5sum_S = 0for i in range(9):sum_S += (i + 1) * c[i]g = math.gcd(sum_S, 9)factors *= gprint(factors % MOD)