C. Quick coffee

Codeforces
IDCF10241C
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Let's say we would like to give change of $d$ dollars after a puchase of coffee. The only coins that we can use have values $a$, $a + 1$, ..., $b$. Is it possible to give out the change? We are interested in even harder quesion: for given $d$ and $a$ what is the smallest $b$ such that the change can be given? The input is two numbers $1 <= a <= d <= 10^9$. Print smallest $b$ such that $d$ is a sum of coins from range $a,..., b$. ## Input The input is two numbers $1 <= a <= d <= 10^9$. ## Output Print smallest $b$ such that $d$ is a sum of coins from range $a,..., b$. [samples]
**Definitions** Let $ t \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, t\} $, let $ n_k \in \mathbb{Z} $ be the target value. Initial state: $ a = 1 $, $ x = 0 $. **Operations** In one operation, choose one of: 1. $ x \leftarrow x + a $ 2. $ a \leftarrow x $, then $ x \leftarrow x + a $ **Objective** For each $ n_k $, find the minimum number of operations to reach $ x = n_k $.
API Response (JSON)
{
  "problem": {
    "name": "C. Quick coffee",
    "description": {
      "content": "Let's say we would like to give change of $d$ dollars after a puchase of coffee. The only coins that we can use have values $a$, $a + 1$, ..., $b$. Is it possible to give out the change? We are intere",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10241C"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Let's say we would like to give change of $d$ dollars after a puchase of coffee. The only coins that we can use have values $a$, $a + 1$, ..., $b$. Is it possible to give out the change? We are intere...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ t \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, t\\} $, let $ n_k \\in \\mathbb{Z} $ be the target value.  \nInitial state: $ a = 1 $, $ x ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments