#PCBBAY0000019. Định dạng căn giữa trong trường rộng 12 (Center Alignment in Width 12)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Định dạng căn giữa trong trường rộng 12 (Center Alignment in Width 12)
Center Alignment in Width 12
Version: Phuoc Hung OJ Extended
Problem Statement
Format a real number with 2 digits after the decimal point and center it in a field at least 12 characters wide. Pad both sides with spaces; if an odd number of spaces is needed, the right side receives the extra space, as in Python 3 ^12.2f. Enclose the field between | characters.
Input
The only line contains a real number .
Output
Print a line of the form |field|, where field is centered in a field at least 12 characters wide. Preserve all padding spaces.
Subtasks
- Subtask 1 (100 points): .
Examples
Example 1
Input
12.5
Output
| 12.50 |
Explanation. The number first becomes 12.50. The 12-character field contains 3 leading and 4 trailing spaces; the | characters expose these spaces in | 12.50 |.
Example 2
Input
-3.25
Output
| -3.25 |
Explanation. The number first becomes -3.25. The 12-character field contains 3 leading and 4 trailing spaces; the | characters expose these spaces in | -3.25 |.
Example 3
Input
123456.7
Output
| 123456.70 |
Explanation. The number first becomes 123456.70. The 12-character field contains 1 leading and 2 trailing spaces; the | characters expose these spaces in | 123456.70 |.