#PCBBAY0000017. Định dạng căn phải trong trường rộng 12 (Right Alignment in Width 12)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Định dạng căn phải trong trường rộng 12 (Right Alignment in Width 12)
Right Alignment in Width 12
Version: Phuoc Hung OJ Extended
Problem Statement
Format a real number with 2 digits after the decimal point, then place it in a field at least 12 characters wide. Right-align the formatted number and pad the left with spaces as needed. Enclose the field between | characters to make its spaces visible.
Input
The only line contains a real number .
Output
Print a line of the form |field|, where field is right-aligned 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 7 leading and 0 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 7 leading and 0 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 3 leading and 0 trailing spaces; the | characters expose these spaces in | 123456.70|.