← All problemsSign in

Minimalistic

Given a number n in one move you can either divide it by 5(if n%5==0) or subtract it by 3. You need to determine the minimum number of moves to make the n equal to 2, if this is not possible print -1. Input format The first line contains t denotes the number of test cases. The next t lines contains integer n. Output format Print minimum number of moves it takes to reach from 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