結果
| 問題 | No.3474 Concat Decimal |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-20 23:00:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 376 ms / 2,000 ms |
| コード長 | 781 bytes |
| 記録 | |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 85,520 KB |
| 実行使用メモリ | 116,712 KB |
| 最終ジャッジ日時 | 2026-03-20 23:01:22 |
| 合計ジャッジ時間 | 4,201 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
import math
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))[1:]
le = [0]*(n-1)
for i in range(n-1):
s = list(str(a[i]))
if s[0] == "0":
continue
while s[-1] == "0":
s.pop()
a[i] = int("".join(s))
le[i] = len(str(a[i]))
cnt2 = [0]*(n-1)
cnt5 = [0]*(n-1)
for i in range(n-1):
while a[i] % 2 == 0 and a[i] != 0:
cnt2[i] += 1
a[i] //= 2
while a[i] % 5 == 0 and a[i] != 0:
cnt5[i] += 1
a[i] //= 5
ans = []
for i in range(n-1):
ans.append(10**le[i]//2**min(le[i], cnt2[i])//5**min(le[i], cnt5[i]))
res = 1
for x in ans:
res = math.lcm(res, x)
print(res)