Hi guys , I just solved the Codeforces Round #377 (Div. 2), problem: (C) Sanatorium , hope you like it .
You are most welcome to submit any other solution .
#include
using namespace std;
int main()
{
long long int a[3], t, i, ans, temp, j;
for(i=0; i<3; i++)
cin>>a[i];
if(a[0]==a[1] && a[0]==a[2])
cout<<0<
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
ans=0;
temp = a[2]-1-a[1];
if(temp>0)
ans += temp;
temp = a[2]-1-a[0];
if(temp>0)
ans += temp;
cout<