GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Thursday, 4 August 2022

[Solution] 2-3 Moves Codeforces Solution


A. 2-3 Moves
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are standing at the point 0 on a coordinate line. Your goal is to reach the point n. In one minute, you can move by 2 or by 3 to the left or to the right (i. e., if your current coordinate is x, it can become x3x2x+2 or x+3). Note that the new coordinate can become negative.

Your task is to find the minimum number of minutes required to get from the point 0 to the point n.

Solution Click Below:-  👉CLICK HERE👈

👇👇👇👇👇

 occupied

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1t104) — the number of test cases. Then t lines describing the test cases follow.

The i-th of these lines contains one integer n (1n109) — the goal of the i-th test case.

Output

For each test case, print one integer — the minimum number of minutes required to get from the point 0 to the point n for the corresponding test case.


No comments:

Post a Comment