Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
333 B
1
Indexable
Never
#include <iostream>
using namespace std;

int main() {
	int a, b, first, second, k, counter = 0; cin >> a >> b >> k;
	first = max(a, b); second = min(a, b);

	while (first >= k) {
		first -= k;
		counter++;
		
		if (second >= k) {
			second -= k;
			counter++;
		}
		else break;
	}

	cout << counter;
	return 0;
}