Codeforces Round #377 (Div. 2) C. Sanatorium 模拟

C. Sanatorium

链接:

http://codeforces.com/contest/732/problem/C

代码:

 1 #include<iostream>
 2 #include<algorithm>
 3 using namespace std;
 4 typedef long long ll;
 5 int main()
 6 {
 7     ll a, b, c;
 8     cin >> a >> b >> c;
 9     ll m = max(a, max(b, c));
10     ll ans = 0;
11     if (a < m) ans += m - 1 - a;
12     if (b < m) ans += m - 1 - b;
13     if (c < m) ans += m - 1 - c;
14     cout << ans << endl;
15     return 0;
16 }

 

posted @ 2016-10-18 18:14  Flowersea  阅读(229)  评论(0编辑  收藏  举报