← All problemsSign in

Infinite GP in Infinite GP

Consider an infinite geometric sequence S={1, 1⁄2, 1⁄4, 1⁄8 … }. For given fraction p⁄q, check whether one can select an infinite geometric sequence R, such that R ⊆ S and Summation of all elements in R is p/q . Input Format First line contains an integer T, representing the number of test cases. The next T lines,each contain two space separated integers, p and q. Output Format The output s

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