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
2 \( \leq \) Z \( \leq \) 10^18
1 \( \leq \) T \( \leq \) 10^6
Sample Input
2 3 4
Sample Output
1 2
Explanation
For the first test case x=0, y=1
For second test case x=2, y=0
Code Editor
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
Submissions
Please login to view your submissions
Similar Problems
Points:20
31 votes
Tags:
MathematicsOpenApprovedEasyMathamatics
Points:20
210 votes
Tags:
Basic ProgrammingSimple-mathEasy
Points:20
27 votes
Tags:
Basic MathC++Math
Editorial
No editorial available for this problem.
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