D. Treasure Box

Codeforces
IDCF10054D
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Your team was exploring an ancient city. Suddenly you found an old scroll with 2 integer numbers N and K, which encrypts the secret code to open a treasure box. Considering a transformation on an integer X described as follows: X = X + X mod 100, the secret code can be obtained by applying the above-described transformation K times successively to N. The input file consists of several datasets. The first line of the input file contains the number of datasets which is a positive integer and is not greater than 500. Each dataset has two space-separated positive integers N and K (1 ≤ N ≤ 109, 1 ≤ K ≤ 109) written on a single line. For each dataset, write on a single line the secret number decrypted from N and K. ## Input The input file consists of several datasets. The first line of the input file contains the number of datasets which is a positive integer and is not greater than 500. Each dataset has two space-separated positive integers N and K (1 ≤ N ≤ 109, 1 ≤ K ≤ 109) written on a single line. ## Output For each dataset, write on a single line the secret number decrypted from N and K. [samples]
**Definitions** Let $ t \in \mathbb{Z} $ be the number of datasets. Let $ D = \{(N_j, K_j) \mid j \in \{1, \dots, t\}\} $ be the set of datasets, where for each $ j $: - $ N_j \in \mathbb{Z}^+ $ is the initial integer. - $ K_j \in \mathbb{Z}^+ $ is the number of transformations. **Constraints** 1. $ 1 \le t \le 500 $ 2. For each $ j \in \{1, \dots, t\} $: - $ 1 \le N_j \le 10^9 $ - $ 1 \le K_j \le 10^9 $ **Objective** For each dataset $ j $, define the transformation $ f(x) = x + (x \bmod 100) $. Compute the result after $ K_j $ applications: $$ R_j = f^{K_j}(N_j) $$ where $ f^k $ denotes the $ k $-fold composition of $ f $.
API Response (JSON)
{
  "problem": {
    "name": "D. Treasure Box",
    "description": {
      "content": "Your team was exploring an ancient city. Suddenly you found an old scroll with 2 integer numbers N and K, which encrypts the secret code to open a treasure box. Considering a transformation on an inte",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10054D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Your team was exploring an ancient city. Suddenly you found an old scroll with 2 integer numbers N and K, which encrypts the secret code to open a treasure box. Considering a transformation on an inte...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ t \\in \\mathbb{Z} $ be the number of datasets.  \nLet $ D = \\{(N_j, K_j) \\mid j \\in \\{1, \\dots, t\\}\\} $ be the set of datasets, where for each $ j $:  \n- $ N_j \\in \\mathbb{Z}^+ $...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments