結果

問題 No.219 巨大数の概算
ユーザー gew1fw
提出日時 2025-06-12 18:44:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 661 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 104,576 KB
最終ジャッジ日時 2025-06-12 18:44:50
合計ジャッジ時間 6,396 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from decimal import Decimal, getcontext, ROUND_FLOOR

getcontext().prec = 40

def main():
    n = int(sys.stdin.readline())
    for _ in range(n):
        a, b = map(int, sys.stdin.readline().split())
        a_dec = Decimal(a)
        log10_a = a_dec.log10()
        l = Decimal(b) * log10_a
        z = l.to_integral_value(rounding=ROUND_FLOOR)
        f = l - z
        m = Decimal(10) ** f
        m_str = "{0:.20f}".format(m)
        parts = m_str.split('.')
        x = parts[0]
        fraction = parts[1]
        y = fraction[0] if len(fraction) > 0 else '0'
        print(f"{int(x)} {int(y)} {int(z)}")

if __name__ == "__main__":
    main()
0