結果
| 問題 |
No.219 巨大数の概算
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 13:31:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 778 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 106,624 KB |
| 最終ジャッジ日時 | 2025-06-12 13:38:31 |
| 合計ジャッジ時間 | 6,336 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 TLE * 45 -- * 1 |
ソースコード
import sys
from decimal import Decimal, getcontext, ROUND_DOWN
getcontext().prec = 50 # 设置足够的精度
def main():
input = sys.stdin.read().split()
n = int(input[0])
idx = 1
for _ in range(n):
a = int(input[idx])
b = int(input[idx+1])
idx +=2
a_dec = Decimal(a)
log_a = a_dec.log10()
total = Decimal(b) * log_a
k = int(total)
f = total - k
value = Decimal(10) ** f
temp = value * Decimal('10')
# 截断到整数部分,使用ROUND_DOWN
xy_int = temp.quantize(Decimal('1.'), rounding=ROUND_DOWN)
xy_int = int(xy_int)
X = xy_int // 10
Y = xy_int % 10
Z = k
print(f"{X} {Y} {Z}")
if __name__ == "__main__":
main()
gew1fw