CodeForces

来源:互联网 发布:淘宝打折 编辑:程序博客网 时间:2024/06/13 23:00
/*  注意!!!题目的理解很重要,我当初就是因为题意理解有误,一直WA    We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left.  这句话表明了:如果在抵达的那天,或者离开的那天,没有吃满3顿,那么这两种少吃的情况,并不算在计算的顿数中*/#include <iostream>typedef long long ll;using namespace std;int main(){cin.tie(0);cin.sync_with_stdio(false);ll b, d, s;while (cin >> b >> d >> s){ll ans = 0, tp = max(b, max(d, s));tp--;if (tp > b) ans += tp - b;if (tp > d) ans += tp - d;if (tp > s) ans += tp - s;cout << ans << endl;}return 0;}

原创粉丝点击