#PCBBAY0000028. Làm tròn đến k chữ số thập phân (Round to k Decimal Places)
Làm tròn đến k chữ số thập phân (Round to k Decimal Places)
Round to k Decimal Places
Version: Phuoc Hung OJ Extended
Problem Statement
Given a real number and an integer , compute Python 3 round(x, k) on the parsed float. Print the resulting number with Python’s default float representation; do not pad with trailing zeros to reach decimal places.
Input
The only line contains a real number and integer .
Output
Print the float returned by round(x, k) using the default Python 3 display.
Subtasks
- Subtask 1 (100 points): ; .
Examples
Example 1
Input
3.14159 3
Output
3.142
Explanation. For input 3.14159 3, round(x, 3) produces 3.142. The float is printed using its default representation, without padding trailing zeros.
Example 2
Input
12.5 4
Output
12.5
Explanation. For input 12.5 4, round(x, 4) produces 12.5. The float is printed using its default representation, without padding trailing zeros.
Example 3
Input
-2.675 2
Output
-2.67
Explanation. For input -2.675 2, round(x, 2) produces -2.67. The float is printed using its default representation, without padding trailing zeros.