結果

問題 No.219 巨大数の概算
ユーザー gew1fw
提出日時 2025-06-12 13:39:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 1,500 ms
コード長 501 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,824 KB
実行使用メモリ 77,680 KB
最終ジャッジ日時 2025-06-12 13:44:25
合計ジャッジ時間 8,474 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
for _ in range(N):
    A, B = map(int, input().split())
    log_A = math.log10(A)
    log_value = B * log_A
    Z = int(log_value)
    frac = log_value - Z
    # Ensure frac is in [0,1)
    if frac < 0:
        frac += 1.0
        Z -= 1
    mantissa = 10 ** frac
    # Check if mantissa is 10 or more due to precision issues
    if mantissa >= 10.0:
        mantissa /= 10.0
        Z += 1
    X = int(mantissa)
    Y = int((mantissa - X) * 10)
    print(f"{X} {Y} {Z}")
0