C. Shahhoud Training Hussain

Codeforces
IDCF10191C
Time2000ms
Memory64MB
Difficulty
English · Original
Formal · Original
Ever since coach Shahhoud started the series "Problem Every Day" . Hussain decided to train really hard. After all, he may get a chance to qualify for the upcoming SCPC contest ! Shahhoud gives Hussain K problems everyday. However, Hussain can solve at most P problems everyday. At the end of the Nth day of training, Shahhoud wants to know how many problems did Hussain miss and hasn't solved yet? The first line contains an integer T, the number of test cases. Each line of the following T lines describes a single test case. Each test case contains 3 space separated integers K, P, N (1 ≤ K, P, N ≤ 109). For each test case print a single line, containing a single integer, denoting the number of problems Hussain has missed by the end of the Nth day. ## Input The first line contains an integer T, the number of test cases.Each line of the following T lines describes a single test case. Each test case contains 3 space separated integers K, P, N (1 ≤ K, P, N ≤ 109). ## Output For each test case print a single line, containing a single integer, denoting the number of problems Hussain has missed by the end of the Nth day. [samples]
**Definitions** Let $ N \in \mathbb{Z} $ be the number of lines. Let $ S \in \mathbb{Z} $ be the shift value, with $ 1 \leq S \leq 10^9 $. Let $ M_1, M_2, \dots, M_N $ be the encrypted messages, each a string over the alphabet $ \Sigma = \{ \text{a-z, A-Z, digits, spaces, punctuation} \} $. Let $ \text{val}(c) $ be the numeric value of an alphabetic character $ c $: - $ \text{val}(c) = \begin{cases} c - \text{'a'} & \text{if } c \in \text{a-z} \\ c - \text{'A'} & \text{if } c \in \text{A-Z} \end{cases} $ Let $ \text{char}_\text{lower}(v) = \text{chr}(\text{'a'} + v \bmod 26) $ Let $ \text{char}_\text{upper}(v) = \text{chr}(\text{'A'} + v \bmod 26) $ **Constraints** 1. $ 1 \leq N \leq 10^3 $ 2. $ 1 \leq S \leq 10^9 $ 3. Total length of all messages $ \leq 10^3 $ **Objective** For each message $ M_k $, decrypt each character $ c \in M_k $ as follows: - If $ c $ is lowercase alphabetic: $$ c' = \text{char}_\text{lower}\left( (\text{val}(c) - S) \bmod 26 \right) $$ - If $ c $ is uppercase alphabetic: $$ c' = \text{char}_\text{upper}\left( (\text{val}(c) - S) \bmod 26 \right) $$ - Otherwise: $ c' = c $ Output the decrypted string for each $ M_k $.
API Response (JSON)
{
  "problem": {
    "name": "C. Shahhoud Training Hussain",
    "description": {
      "content": "Ever since coach Shahhoud started the series \"Problem Every Day\" . Hussain decided to train really hard. After all, he may get a chance to qualify for the upcoming SCPC contest ! Shahhoud gives Hussa",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10191C"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Ever since coach Shahhoud started the series \"Problem Every Day\" . Hussain decided to train really hard. After all, he may get a chance to qualify for the upcoming SCPC contest !\n\nShahhoud gives Hussa...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ N \\in \\mathbb{Z} $ be the number of lines.  \nLet $ S \\in \\mathbb{Z} $ be the shift value, with $ 1 \\leq S \\leq 10^9 $.  \nLet $ M_1, M_2, \\dots, M_N $ be the encrypted messages,...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments