Kotlin Heroes: Episode 3 |
---|
Finished |
Polycarp is working on the implementation of displaying likes on the Codehorses social network. The number of likes should be displayed in a format that will be easy to read by users. It was decided that for large numbers of likes the format should be like 123K (one hundred twenty-three thousand) or like 56M (fifty-six million).
The following displaying strategy has been approved:
Help Polycarp implement this part of the functionality: for a given non-negative integer number of likes $$$n$$$, print its view in the Codehorses interface.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. The following are descriptions of the $$$t$$$ input test cases, one per line.
The description of each test case consists of a single line that contains a non-negative integer $$$n$$$ ($$$0 \le n \le 2\cdot10^9$$$) — the number of likes.
Print $$$t$$$ answers to the given test cases in the order from the input. Each printed value must have one of the following types:
The answer is equal to a view which is the closest (by difference) to the given number $$$n$$$. If this rounding is ambiguous, then round answer up (to a greater value).
9 999 123 0 1782 31415926 1500 999999 35499710 2000000000
999 123 0 2K 31M 2K 1M 35M 2000M
Let's describe some test cases:
Name |
---|