Namuk's Chicken Coop
Time limit2sMemory limit256 MB
From the total number of legs and chickens, find how many chickens lost a leg and how many are intact.
- Level
Easy1 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
Namuk runs an egg shop and collects eggs from his chicken coop every day. One day he walked in and found that some of the chickens had lost a leg. He wanted to know how many chickens had lost a leg, but there were far too many to count one by one, so he counted every leg in the coop instead.
An intact chicken has two legs, and a chicken that lost a leg has one. Given the total number of legs and the number of chickens, solve Namuk's problem for him.
Input
The first line contains the number of test cases ().
Each of the next lines contains the total number of chicken legs () and the number of chickens (), separated by a space.
Output
For each test case, print the number of chickens that lost a leg and the number of intact chickens on one line, separated by a space.