← All problemsSign in

Rick In Space

Rick is wandering about in his spaceship, all alone in the vast universe. He's pretty bored as he has no one for company. All he's got to kill time are two toys which he received as birthday presents. The first toy generates a number between $1$ and $N$, inclusive. It generates all numbers with equal probability. The second toy generates the answer of the greatest common divisor, or $gcd$ of any n

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