Submission #235116

#TimeUsernameProblemLanguageResultExecution timeMemory
235116NONAMEKošnja (COCI17_kosnja)C++17
50 / 50
140 ms760 KiB
#include <bits/stdc++.h>
#define el '\n'
using namespace std;
int main() {
	int q;
	
	cin >> q;
	while (q--) {
		int n, m, ans = 0;
		cin >> n >> m;
		if (n > m)
			swap(n, m);
		
		ans = 2 * (n - 1);
//		if ((n & 1) && (m & 1)) ans = (n - 1) + (m - 1); else
//		if (!(n & 1) && !(m & 1)) ans = n + (m - 1);
//			else ans = 2 * (n - 1);
		
		cout << ans << el;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...