题库练习 Polycarp and Coins
← 上一题 下一题 →

A14422 | Polycarp and Coins

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Polycarp must pay exactly $n$ burles at the checkout. He has coins of two nominal values: $1$ burle and $2$ burles. Polycarp likes both kinds of coins equally. So he doesn't want to pay with more coins of one type than with the other.

Thus, Polycarp wants to minimize the difference between the count of coins of $1$ burle and $2$ burles being used. Help him by determining two non-negative integer values $c_1$ and $c_2$ which are the number of coins of $1$ burle and $2$ burles, respectively, so that the total value of that number of coins is exactly $n$ (i. e. $c_1 + 2 \cdot c_2 = n$ ), and the absolute value of the difference between $c_1$ and $c_2$ is as little as possible (i. e. you must minimize $|c_1-c_2|$ ).

输入格式

The first line contains one integer $t$ ( $1 \le t \le 10^4$ ) — the number of test cases. Then $t$ test cases follow.

Each test case consists of one line. This line contains one integer $n$ ( $1 \le n \le 10^9$ ) — the number of burles to be paid by Polycarp.

输出格式

For each test case, output a separate line containing two integers $c_1$ and $c_2$ ( $c_1, c_2 \ge 0$ ) separated by a space where $c_1$ is the number of coins of $1$ burle and $c_2$ is the number of coins of $2$ burles. If there are multiple optimal solutions, print any one.

输入输出样例

输入 #1
6
1000
30
1
32
1000000000
5
输出 #1
334 333
10 10
1 0
10 11
333333334 333333333
1 2
C++ 编辑器
输入
输出