ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Open Personal Contest 2007

About     Problems     Submit solution     Judge status     Standings
Contest is over

C. Football in Gondor

Time limit: 1.0 second
Memory limit: 64 MB
Gondor Football Championship is in full swing. Unfortunately, Gandalf missed the beginning of the championship (he had to visit the Mines of Moria because a sleeping dragon was found there). Upon his return, he learned from the omnipresent hobbits that his favorite team Dinamo had already scored K balls and missed L balls. Help Gandalf to determine the maximal and minimal numbers of points that Dinamo could earn. In Gondor, if a team wins a match, it gets 3 points, for a draw it gets 1 point, and in the case of defeat the team gets 0 points.


There are three integers in one line separated with a space: K, L, and N. Here K is the number of scored balls, L is the number of missed balls, and N is the number of matches that have been played by Dinamo (0 ≤ KL ≤ 109, 1 ≤ N ≤ 109).


Output the maximal and minimal numbers of points that Dinamo could earn. The numbers must be separated with a space.


3 2 2
4 3
3 1 2
6 3
3 0 4
10 6
3 0 1
3 3
Problem Author: Sergey Pupyrev
Problem Source: VIII USU Open Personal Contest (March 3, 2007)
To submit the solution for this problem go to the Problem set: 1534. Football in Gondor