305800: CF1091A. New Year and the Christmas Ornament
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
New Year and the Christmas Ornament
题意翻译
## 题目描述: Alice和Bob正在装饰一棵圣诞树。 Alice希望黄、蓝、红3种颜色的装饰被用在圣诞树上。他们有$y$个黄色装饰,$b$个蓝色装饰和$r$个红色装饰。 Bob认为满足以下条件的圣诞树是美丽的: + 所用蓝色装饰的数目比黄色装饰的数目多1 + 所用红色装饰的数目比蓝色装饰的数目多1 Alice希望选择尽可能多的装饰,但她也希望按照Bob的标准圣诞树是美丽的。 由于Alice和Bob忙着准备圣诞晚餐,他们希望你能帮忙找到,在保持圣诞树美丽的前提下,装饰的最大使用数量。 ## 输入格式: 一行3个整数$y$, $b$, $r$表示黄色、蓝色、红色装饰的数量($1\leq y\leq100$, $2\leq b\leq100$, $3\leq r\leq100$)。 保证至少可以选6($1+2+3=6$)个装饰。 ## 输出格式: 一个整数,表示最大的可选装饰数量。题目描述
Alice and Bob are decorating a Christmas Tree. Alice wants only $ 3 $ types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have $ y $ yellow ornaments, $ b $ blue ornaments and $ r $ red ornaments. In Bob's opinion, a Christmas Tree will be beautiful if: - the number of blue ornaments used is greater by exactly $ 1 $ than the number of yellow ornaments, and - the number of red ornaments used is greater by exactly $ 1 $ than the number of blue ornaments. That is, if they have $ 8 $ yellow ornaments, $ 13 $ blue ornaments and $ 9 $ red ornaments, we can choose $ 4 $ yellow, $ 5 $ blue and $ 6 $ red ornaments ( $ 5=4+1 $ and $ 6=5+1 $ ). Alice wants to choose as many ornaments as possible, but she also wants the Christmas Tree to be beautiful according to Bob's opinion. In the example two paragraphs above, we would choose $ 7 $ yellow, $ 8 $ blue and $ 9 $ red ornaments. If we do it, we will use $ 7+8+9=24 $ ornaments. That is the maximum number. Since Alice and Bob are busy with preparing food to the New Year's Eve, they are asking you to find out the maximum number of ornaments that can be used in their beautiful Christmas Tree! It is guaranteed that it is possible to choose at least $ 6 $ ( $ 1+2+3=6 $ ) ornaments.输入输出格式
输入格式
The only line contains three integers $ y $ , $ b $ , $ r $ ( $ 1 \leq y \leq 100 $ , $ 2 \leq b \leq 100 $ , $ 3 \leq r \leq 100 $ ) — the number of yellow, blue and red ornaments. It is guaranteed that it is possible to choose at least $ 6 $ ( $ 1+2+3=6 $ ) ornaments.
输出格式
Print one number — the maximum number of ornaments that can be used.
输入输出样例
输入样例 #1
8 13 9
输出样例 #1
24
输入样例 #2
13 3 6
输出样例 #2
9