非常简单的一道题。
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <deque>
#include <iostream>
#include <string>
using namespace std;
int temp[4];
int main() {
for (int i = 1;i <= 3;++i) {
scanf("%d", &temp[i]);
}
int mymax = 0;
int mymax_index = 0;
for (int i = 1;i <= 3;++i) {
if (mymax <= temp[i]) {
mymax = temp[i];
mymax_index = i;
}
}
if (mymax_index == 1) {
if (temp[1] < temp[2] + temp[3]) {
printf("0\n");
}
else {
printf("%d\n", temp[1] - temp[2] - temp[3] + 1);
}
}
else if (mymax_index == 2) {
if (temp[2] < temp[1] + temp[3]) {
printf("0\n");
}
else {
printf("%d\n", temp[2] - temp[1] - temp[3] + 1);
}
}
else {
if (temp[3] < temp[1] + temp[2]) {
printf("0\n");
}
else {
printf("%d\n", temp[3] - temp[1] - temp[2] + 1);
}
}
//system("pause");
return 0;
}