← All problemsSign in

Magical Coins

CodeChefRating 2937Open on judge ↗

You are shopping in a store that has $n$ magical stones. For each stone, there is a probability $g$ that you will put it in your bag. The value $g$ is the same for all stones, all stones are independent, and you are given the value of $g$ modulo $998\ 244\ 353$. Suppose when you checkout, you have $r$ stones in your bag. Then you will be charged a price of $(ar+b)^k$ magical coins, where $a, b,

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start