170. Cooldown

Codeforces
IDCF10269170
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Every morning after you get out of bed, you brew yourself a nice cup of coffee to get yourself ready for the day. However, most of the time when you pick up the coffee to drink, it's too hot for you to drink! You know that Newton's Formula of Cooling is $T (t) = T_s + (T_0 -T_s) e^(-k t)$, where: $T (t)$ is the temperature of the coffee at time $t$, $T_s$ is the ambient temperature of the room, $T_0$ is the initial temperature of the coffee, and $k$ is the decay constant. You also know that the coffee reaches your favorable heat from a initial temperature of 210 degrees to 120 degrees after 15 minutes of cooling, in a room temperature of 70 degrees. The first line of input will be an integer $n$, which denotes the amount of test cases to follow in the subsequent lines. The test cases will contain a positive integer $T (t)$, the temperature at time $t$. For each test case, output the time $t$ minutes it takes for the freshly brewed coffee to cool town to temperature $T (t)$. ## Input The first line of input will be an integer $n$, which denotes the amount of test cases to follow in the subsequent lines. The test cases will contain a positive integer $T (t)$, the temperature at time $t$. ## Output For each test case, output the time $t$ minutes it takes for the freshly brewed coffee to cool town to temperature $T (t)$. [samples]
**Definitions** Let $ T_s = 70 $ be the ambient temperature. Let $ T_0 = 210 $ be the initial temperature of the coffee. Let $ k \in \mathbb{R}^+ $ be the decay constant, determined by the condition $ T(15) = 120 $. The cooling model is: $$ T(t) = T_s + (T_0 - T_s) e^{-kt} $$ **Constraints** 1. $ n \in \mathbb{Z} $, $ n \geq 1 $ — number of test cases. 2. For each test case, input $ T(t) \in \mathbb{R} $, with $ 70 < T(t) \leq 210 $. **Objective** For each test case, solve for $ t $: $$ T(t) = 70 + (210 - 70) e^{-kt} $$ $$ \Rightarrow t = -\frac{1}{k} \ln\left( \frac{T(t) - 70}{140} \right) $$ where $ k $ is precomputed from: $$ 120 = 70 + 140 e^{-15k} \Rightarrow k = -\frac{1}{15} \ln\left( \frac{50}{140} \right) = \frac{1}{15} \ln\left( \frac{140}{50} \right) $$
API Response (JSON)
{
  "problem": {
    "name": "170. Cooldown",
    "description": {
      "content": "Every morning after you get out of bed, you brew yourself a nice cup of coffee to get yourself ready for the day. However, most of the time when you pick up the coffee to drink, it's too hot for you t",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269170"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Every morning after you get out of bed, you brew yourself a nice cup of coffee to get yourself ready for the day. However, most of the time when you pick up the coffee to drink, it's too hot for you t...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T_s = 70 $ be the ambient temperature.  \nLet $ T_0 = 210 $ be the initial temperature of the coffee.  \nLet $ k \\in \\mathbb{R}^+ $ be the decay constant, determined by the condi...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments