303794: CF732C. Sanatorium

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Sanatorium

题意翻译

## 题目描述 当瓦西里在疗养院度假回来,发现他完全忘了他的度假的细节! 每天疗养院的餐厅里都有早餐、午餐和晚餐(当然,按这个顺序)。瓦西里现在唯一拥有的就是一张餐厅的卡片,上面写着他吃过多少次早餐、午餐和晚餐(因此,卡片包含三个整数)。瓦西里有时可能会错过一些食物,例如,他可以吃早饭和晚餐,但晚餐不吃,或者也许在某些天,他根本没有在餐厅。 瓦西里不记得一天中他到达疗养院的时间(早餐前、午餐前、晚餐前或晚餐后),以及他离开疗养院的时间(早餐前、午餐前、晚餐前或晚餐后)。所以他考虑了这些选择中的任何一个。瓦西里来到疗养院后,一直呆在那里直到离开。请注意,瓦西里可能是在抵达疗养院的同一天离开的。 根据卡片上的说明,帮助瓦西里确定他可能错过的餐厅的最少用餐次数。我们不应算作瓦西里抵达前一天的误餐,也不应算作瓦西里离开后一天的误餐。 根据卡片上的说明,帮助瓦西里确定他可能错过的餐厅的最少用餐次数。我们不应算作瓦西里抵达前一天的没吃的餐,也不应算作瓦西里离开后一天的没吃的餐。 ## 输入输出格式 ### 输入格式: 只有一行包含三个整数b、d和s(0<=b、d、s<=10^18、b+d+s>=1)分别表示瓦西里在疗养院度假期间的早餐、午餐和晚餐数量。 ### 输出格式: 输出一个整数表示瓦西里在度假期间可能错过的最少用餐次数。 ## 说明 在第一个样例中,瓦西里可能错过了一顿晚餐,例如,如果他在早餐前到达,在疗养院呆了两天(包括抵达当天),然后在第三天早餐后离开。 在第二个样例中,瓦西里可以在早餐前到达,吃过它,然后立即离开疗养院,没有错过任何一顿饭。 在第三个样例中,瓦西里可能在疗养院呆了一天,没有错过任何一顿饭。

题目描述

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes how many times he had a breakfast, a dinner and a supper (thus, the card contains three integers). Vasiliy could sometimes have missed some meal, for example, he could have had a breakfast and a supper, but a dinner, or, probably, at some days he haven't been at the dining room at all. Vasiliy doesn't remember what was the time of the day when he arrived to sanatorium (before breakfast, before dinner, before supper or after supper), and the time when he left it (before breakfast, before dinner, before supper or after supper). So he considers any of these options. After Vasiliy arrived to the sanatorium, he was there all the time until he left. Please note, that it's possible that Vasiliy left the sanatorium on the same day he arrived. According to the notes in the card, help Vasiliy determine the minimum number of meals in the dining room that he could have missed. We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left.

输入输出格式

输入格式


The only line contains three integers $ b $ , $ d $ and $ s $ ( $ 0<=b,d,s<=10^{18},b+d+s>=1 $ ) — the number of breakfasts, dinners and suppers which Vasiliy had during his vacation in the sanatorium.

输出格式


Print single integer — the minimum possible number of meals which Vasiliy could have missed during his vacation.

输入输出样例

输入样例 #1

3 2 1

输出样例 #1

1

输入样例 #2

1 0 0

输出样例 #2

0

输入样例 #3

1 1 1

输出样例 #3

0

输入样例 #4

1000000000000000000 0 1000000000000000000

输出样例 #4

999999999999999999

说明

In the first sample, Vasiliy could have missed one supper, for example, in case he have arrived before breakfast, have been in the sanatorium for two days (including the day of arrival) and then have left after breakfast on the third day. In the second sample, Vasiliy could have arrived before breakfast, have had it, and immediately have left the sanatorium, not missing any meal. In the third sample, Vasiliy could have been in the sanatorium for one day, not missing any meal.

Input

题意翻译

## 题目描述 当瓦西里在疗养院度假回来,发现他完全忘了他的度假的细节! 每天疗养院的餐厅里都有早餐、午餐和晚餐(当然,按这个顺序)。瓦西里现在唯一拥有的就是一张餐厅的卡片,上面写着他吃过多少次早餐、午餐和晚餐(因此,卡片包含三个整数)。瓦西里有时可能会错过一些食物,例如,他可以吃早饭和晚餐,但晚餐不吃,或者也许在某些天,他根本没有在餐厅。 瓦西里不记得一天中他到达疗养院的时间(早餐前、午餐前、晚餐前或晚餐后),以及他离开疗养院的时间(早餐前、午餐前、晚餐前或晚餐后)。所以他考虑了这些选择中的任何一个。瓦西里来到疗养院后,一直呆在那里直到离开。请注意,瓦西里可能是在抵达疗养院的同一天离开的。 根据卡片上的说明,帮助瓦西里确定他可能错过的餐厅的最少用餐次数。我们不应算作瓦西里抵达前一天的误餐,也不应算作瓦西里离开后一天的误餐。 根据卡片上的说明,帮助瓦西里确定他可能错过的餐厅的最少用餐次数。我们不应算作瓦西里抵达前一天的没吃的餐,也不应算作瓦西里离开后一天的没吃的餐。 ## 输入输出格式 ### 输入格式: 只有一行包含三个整数b、d和s(0<=b、d、s<=10^18、b+d+s>=1)分别表示瓦西里在疗养院度假期间的早餐、午餐和晚餐数量。 ### 输出格式: 输出一个整数表示瓦西里在度假期间可能错过的最少用餐次数。 ## 说明 在第一个样例中,瓦西里可能错过了一顿晚餐,例如,如果他在早餐前到达,在疗养院呆了两天(包括抵达当天),然后在第三天早餐后离开。 在第二个样例中,瓦西里可以在早餐前到达,吃过它,然后立即离开疗养院,没有错过任何一顿饭。 在第三个样例中,瓦西里可能在疗养院呆了一天,没有错过任何一顿饭。

加入题单

算法标签: