結果

問題 No.3474 Concat Decimal
コンテスト
ユーザー ルク
提出日時 2026-03-20 22:56:47
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 757 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 286 ms
コンパイル使用メモリ 84,976 KB
実行使用メモリ 116,648 KB
最終ジャッジ日時 2026-03-20 22:56:53
合計ジャッジ時間 4,093 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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**cnt2[i]//5**cnt5[i])
    res = 1
    for x in ans:
        res = math.lcm(res, x)
    print(res)
0