CodeForces - 732C Sanatorium

xiaoxiao2021-02-28  41

/* 注意!!!题目的理解很重要,我当初就是因为题意理解有误,一直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; }
转载请注明原文地址: https://www.6miu.com/read-40535.html

最新回复(0)