結果
問題 | No.379 五円硬貨 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:11:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 107 ms / 1,000 ms |
コード長 | 749 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 80,640 KB |
最終ジャッジ日時 | 2025-03-20 21:12:26 |
合計ジャッジ時間 | 2,759 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
from decimal import Decimal, getcontextgetcontext().prec = 50 # Setting a high precision to handle large numbers accuratelyn, g, v = map(int, input().split())coins = n // 5total_gas = coins * g# Using Decimal for high precision divisionresult = Decimal(str(total_gas)) / Decimal(str(v))result = result.normalize()# Convert result to string for formattingresult_str = format(result, 'f')# Process the string to remove trailing zeros and unnecessary decimal pointsif '.' in result_str:integer_part, fractional_part = result_str.split('.')fractional_part = fractional_part.rstrip('0')if fractional_part:print(f"{integer_part}.{fractional_part}")else:print(integer_part)else:print(result_str)