A. Rounding

Codeforces
IDCF898A
Time1000ms
Memory256MB
Difficulty
implementationmath
English · Original
Chinese · Translation
Formal · Original
Vasya has a non-negative integer _n_. He wants to round it to nearest integer, which ends up with 0. If _n_ already ends up with 0, Vasya considers it already rounded. For example, if _n_ = 4722 answer is 4720. If _n_ = 5 Vasya can round it to 0 or to 10. Both ways are correct. For given _n_ find out to which integer will Vasya round it. ## Input The first line contains single integer _n_ (0 ≤ _n_ ≤ 109) — number that Vasya has. ## Output Print result of rounding _n_. Pay attention that in some cases answer isn't unique. In that case print any correct answer. [samples] ## Note In the first example _n_ = 5. Nearest integers, that ends up with zero are 0 and 10. Any of these answers is correct, so you can print 0 or 10.
Vasya 有一个非负整数 $n$。他希望将其四舍五入到最近的、以 $0$ 结尾的整数。如果 $n$ 已经以 $0$ 结尾,Vasya 认为它已经四舍五入。 例如,如果 $n = 4722$,答案是 $4720$。如果 $n = 5$,Vasya 可以将其四舍五入到 $0$ 或 $10$,两种方式都是正确的。 对于给定的 $n$,请找出 Vasya 会将其四舍五入到哪个整数。 第一行包含一个整数 $n$($0 ≤ n ≤ 10^9$)——Vasya 拥有的数字。 请输出对 $n$ 四舍五入的结果。请注意,在某些情况下答案不唯一。在这种情况下,请输出任意一个正确答案。 在第一个例子中,$n = 5$。以零结尾的最近整数是 $0$ 和 $10$。这两个答案都是正确的,因此你可以输出 $0$ 或 $10$。 ## Input 第一行包含一个整数 $n$($0 ≤ n ≤ 10^9$)——Vasya 拥有的数字。 ## Output 请输出对 $n$ 四舍五入的结果。请注意,在某些情况下答案不唯一。在这种情况下,请输出任意一个正确答案。 [samples] ## Note 在第一个例子中,$n = 5$。以零结尾的最近整数是 $0$ 和 $10$。这两个答案都是正确的,因此你可以输出 $0$ 或 $10$。
**Definitions** Let $ n \in \mathbb{Z}_{\geq 0} $ be the input integer. **Constraints** $ 0 \leq n \leq 10^9 $ **Objective** Find an integer $ r $ such that: - $ r \equiv 0 \pmod{10} $, - $ |n - r| $ is minimized. If multiple such $ r $ exist, output any one.
Samples
Input #1
5
Output #1
0
Input #2
113
Output #2
110
Input #3
1000000000
Output #3
1000000000
Input #4
5432359
Output #4
5432360
API Response (JSON)
{
  "problem": {
    "name": "A. Rounding",
    "description": {
      "content": "Vasya has a non-negative integer _n_. He wants to round it to nearest integer, which ends up with 0. If _n_ already ends up with 0, Vasya considers it already rounded. For example, if _n_ = 4722 answ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF898A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Vasya has a non-negative integer _n_. He wants to round it to nearest integer, which ends up with 0. If _n_ already ends up with 0, Vasya considers it already rounded.\n\nFor example, if _n_ = 4722 answ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Vasya 有一个非负整数 $n$。他希望将其四舍五入到最近的、以 $0$ 结尾的整数。如果 $n$ 已经以 $0$ 结尾,Vasya 认为它已经四舍五入。\n\n例如,如果 $n = 4722$,答案是 $4720$。如果 $n = 5$,Vasya 可以将其四舍五入到 $0$ 或 $10$,两种方式都是正确的。\n\n对于给定的 $n$,请找出 Vasya 会将其四舍五入到哪个整数。\n\n第一行包含一个...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}_{\\geq 0} $ be the input integer.\n\n**Constraints**  \n$ 0 \\leq n \\leq 10^9 $\n\n**Objective**  \nFind an integer $ r $ such that:  \n- $ r \\equiv 0 \\pmod{10} $,  \n- ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments