Problem hidden
PENCIL - Taking Pencils
I think you remember this problem from your college years. We hav 20 blue pencils, 10 red pencils and 5 green pencils in the box. What is the minimum number of pencils we should take out of the box so that we can be sure that we will have at least 1 pencil of each color. Your task is to write a code which will give solution for different cases of this problem.
Input
The input contains 3 numbers B,R,G. B shows the number of blue pencils, R shows the number of red pencils and G - the number of green pencils.
Output
Output contains 1 line, the minimum number of pencils we should take out so that we can be sure that we took at least 1 pencil of each color.
Example
Input: 20 10 5 Output: 31
Added by: | x |
Date: | 2014-01-29 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | college textbooks |