문제2644--Horns

2644: Horns

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 3  통과: 2
[제출] [채점기록] [묻고답하기]

문제 설명

Alan passed through the forest of horns. There are only two kinds of beasts, unicorns and
twinhorns, in this forest. Every unicorn has one horn on its head, and every twinhorn has two
horns on its head. Alan saw n horns and m beasts in total. Please write a program to compute
the number of unicorns and the number of twinhorns seen by Alan.

입력 설명

The first line contains an integer $T$ indicating the number of test cases, where $T \leq 25$. Each
test case has exactly one line. This line contains two integers n and m separated by a blank,
where $1 \leq n \leq 300$ and $m \leq n \leq 2m$. Alan saw $n$ horns and $m$ beasts in total.

출력 설명

For each test case, output one line containing two integers $u$ and $t$ separated by a blank, where
$u$ and $t$ are the number of unicorns and the number of twinhorns, respectively.

입력 예시 Copy

2
5 3
7 5

출력 예시 Copy

1 2
3 2

출처/분류