Codeforces Round 516 (Div. 2, by Moscow Team Olympiad)
A
Make a triangle!
Codeforces
800
原题
←B →
翻译中…

Masha has three sticks of length $a$, $b$ and $c$ centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks.

翻译中…

What is the minimum number of minutes she needs to spend increasing the stick's length in order to be able to assemble a triangle of positive area. Sticks should be used as triangle's sides (one stick for one side) and their endpoints should be located at triangle's vertices.

翻译中…

Input

翻译中…

The only line contains tree integers $a$, $b$ and $c$ ($1 \leq a, b, c \leq 100$) — the lengths of sticks Masha possesses.

翻译中…

Output

翻译中…

Print a single integer — the minimum number of minutes that Masha needs to spend in order to be able to make the triangle of positive area from her sticks.

翻译中…

Note

翻译中…

In the first example, Masha can make a triangle from the sticks without increasing the length of any of them.

翻译中…

In the second example, Masha can't make a triangle of positive area from the sticks she has at the beginning, but she can spend one minute to increase the length $2$ centimeter stick by one and after that form a triangle with sides $3$, $3$ and $5$ centimeters.

翻译中…

In the third example, Masha can take $33$ minutes to increase one of the $10$ centimeters sticks by $33$ centimeters, and after that take $48$ minutes to increase another $10$ centimeters stick by $48$ centimeters. This way she can form a triangle with lengths $43$, $58$ and $100$ centimeters in $81$ minutes. One can show that it is impossible to get a valid triangle faster.

翻译中…

样例

Input #1
3 4 5
Output #1
0
InputCopy OutputCopy
Input #2
2 5 3
Output #2
1
InputCopy OutputCopy
Input #3
100 10 10
Output #3
81
InputCopy OutputCopy
题目信息
题号
1064A
时间限制
2 s
内存限制
256 MB
标签
暴力
计算几何
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。