結果

問題 No.219 巨大数の概算
ユーザー gew1fw
提出日時 2025-06-12 14:06:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 99,464 KB
最終ジャッジ日時 2025-06-12 14:08:07
合計ジャッジ時間 31,592 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 TLE * 27 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal, getcontext, ROUND_DOWN

getcontext().prec = 50  # Precision for logarithm calculations

def compute_values(a, b):
    log_a = Decimal(a).ln() / Decimal(10).ln()
    log_ab = log_a * b
    m = int(log_ab)
    f = log_ab - m
    
    # Calculate 10^f with adjusted precision for efficiency
    getcontext().prec = 20
    t = (10 ** f).quantize(Decimal('1.0'), rounding=ROUND_DOWN)
    x = int(t)
    y = int((t - x) * 10)
    return x, y, m

n = int(input())
for _ in range(n):
    a, b = map(int, input().split())
    x, y, z = compute_values(a, b)
    print(x, y, z)
0