Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
341 B
3
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
	int n, m, l, e, k, ma = 0, na = 0, la = 0, io = 0;
	cin >> n >> m >> l >> k;
	e = k * 2;
	if (e <= n&&e<=m&&e<=l) {
		io = 0;
		cout << 0;
	}
	if (e > n) {
		na = e - n;
	}
	if (e > m) {
		ma = e - m;
	}
	if (e > l) {
		la = e - l;
	}
	cout << na + ma + la;
}

Leave a Comment