LCC '25 Contest 2 J2 - Animal Pens
View as PDFIn the morning, farmer John does a count of all of the animals in his pen. His pens consist of only cows and chickens. For those of you who don't know, a cow has 4 legs, and a chicken has 2 legs.
John counts heads and
legs total. Determine the number of cows and chickens.
Subtasks
Subtask 1 [30%]
Subtask 2 [70%]
No further subtasks.
Input Specifications
The first and only line will contain space-separated integers and
.
Output Specifications
One one line, output the number of cows in the pens, followed by the number of chickens. It is guaranteed that there is an integer solution.
Sample Input
9 28
Sample Output
5 4
Explanation for Sample Output
With 5 cows and 4 chickens, there are legs in total.
Comments