Simple Equations
Practice
0 (0 votes)
Implementation
Easy
Math
Problem
47% Success 592 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Adi Loves to play with Linear Equations.

One Day he came across a simple equation of the form\(2x+3y=z\).  Given the value of z he simply wants to find the minimum sum of x+y such that x>=0 and y>=0 are integers.

 

Input Format:

In the first line you are given an integer t, number of test cases.

The next t lines contain an integer z.

 

Output Format:

Print the value of minimum sum x+y.

 

INPUT CONSTRAINTS

\( \leq \) Z \( \leq \) 10^18

1 \( \leq \) T \( \leq \) 10^6

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
Tags:
Easy
Points:20
836 votes
Tags:
Ad-HocSimulationEasyMathematicsOpenApprovedMathamatics
Points:20
56 votes
Tags:
Ad-HocEasyMath
Editorial

No editorial available for this problem.