3 10
229596204
An attack by Takahashi reduces the monster's stamina by $2$ with probability $\frac{10}{100}=\frac{1}{10}$ and by $1$ with probability $\frac{100-10}{100}=\frac{9}{10}$.
* The monster's initial stamina is $3$.
* After the first attack, the monster's stamina is $2$ with probability $\frac{9}{10}$ and $1$ with probability $\frac{1}{10}$.
* After the second attack, the monster's stamina is $1$ with probability $\frac{81}{100}$, $0$ with probability $\frac{18}{100}$, and $-1$ with probability $\frac{1}{100}$. With probability $\frac{18}{100}+\frac{1}{100}=\frac{19}{100}$, the stamina becomes $0$ or less, and Takahashi stops attacking after two attacks.
* If the stamina remains $1$ after two attacks, the monster's stamina always becomes $0$ or less by the third attack, so he stops attacking after three attacks.
Therefore, the expected value is $2\times \frac{19}{100}+3\times\left(1-\frac{19}{100}\right)=\frac{281}{100}$. Since $229596204 \times 100 \equiv 281\pmod{998244353}$, print $229596204$.5 100
3 Takahashi's attack always reduces the monster's stamina by $2$. After the second attack, the stamina remains $5-2\times 2=1$, so the third one is required.
280 59
567484387
{
"problem": {
"name": "Critical Hit",
"description": {
"content": "There is a monster with initial stamina $N$. Takahashi repeatedly attacks the monster while the monster's stamina remains $1$ or greater. An attack by Takahashi reduces the monster's stamina by $2$ ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc280_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a monster with initial stamina $N$. \nTakahashi repeatedly attacks the monster while the monster's stamina remains $1$ or greater.\nAn attack by Takahashi reduces the monster's stamina by $2$ ...",
"is_translate": false,
"language": "English"
}
]
}