結果
| 問題 |
No.1632 Sorting Integers (GCD of M)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:50:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 351 ms |
| コンパイル使用メモリ | 81,420 KB |
| 実行使用メモリ | 54,020 KB |
| 最終ジャッジ日時 | 2025-04-15 21:52:01 |
| 合計ジャッジ時間 | 4,275 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 WA * 20 |
ソースコード
import math
MOD = 10**9 + 7
N = int(input())
c = list(map(int, input().split()))
# Check if all digits are even (1,3,5,7,9 have counts zero)
all_even = True
for i in [0, 2, 4, 6, 8]:
if c[i] > 0:
all_even = False
break
# Check if all digits are 5
all_five = (c[4] == N)
# Calculate the sum of all digits
sum_s = 0
for i in range(9):
sum_s += (i + 1) * c[i]
# Compute GCD of sum_s and 9
g = math.gcd(sum_s, 9)
# Determine factors
factor_2 = 2 if all_even else 1
factor_5 = 5 if all_five else 1
# Calculate the result
result = (factor_2 * factor_5 * g) % MOD
print(result)
lam6er