A13211 | Likes Display
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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:
- either an integer from 0 to 999 which corresponds just to the number of likes,
- or a number of thousands from 1K to 999K,
- or a number of millions from 1M to 2000M.
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).
- either an integer from 0 to 999 which corresponds just to the number of likes,
- or a number of thousands from 1K to 999K,
- or a number of millions from 1M to 2000M.
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).
输出格式
Let's describe some test cases:
- $1782$ can be displayed either as 1K or as 2K but 2K is the nearest view;
- $1500$ have same difference with 1K and 2K so it should be rounded up;
- $999999$ should be displayed as 1M since it's closer to it than to 999K.
- $1782$ can be displayed either as 1K or as 2K but 2K is the nearest view;
- $1500$ have same difference with 1K and 2K so it should be rounded up;
- $999999$ should be displayed as 1M since it's closer to it than to 999K.
输入输出样例
输入 #1
9 999 123 0 1782 31415926 1500 999999 35499710 2000000000
输出 #1
999 123 0 2K 31M 2K 1M 35M 2000M
Let's describe some test cases:
- $1782$ can be displayed either as 1K or as 2K but 2K is the nearest view;
- $1500$ have same difference with 1K and 2K so it should be rounded up;
- $999999$ should be displayed as 1M since it's closer to it than to 999K.
- $1782$ can be displayed either as 1K or as 2K but 2K is the nearest view;
- $1500$ have same difference with 1K and 2K so it should be rounded up;
- $999999$ should be displayed as 1M since it's closer to it than to 999K.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted