GCD Exploration
CodeChefOpen on judge ↗
Professor Numerico is going big this time. First, he selects three numbers: NN, aa, and bb. Then he builds number AA by repeating NN aa times, and builds number BB by repeating NN bb times. For example, if N=123N=123, a=2a=2, and b=3b=3, then A=123123A=123123 and B=123123123B=123123123. After building the two numbers, he gives them to Dumdum and asks him to find the greatest common divisor (GCD)
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.
Sign in to chat with the tutor and save your progress.
Sign in to start