답안 #235116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235116 2020-05-27T06:23:22 Z NONAME Košnja (COCI17_kosnja) C++17
50 / 50
140 ms 760 KB
#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;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 92 ms 504 KB Output is correct
7 Correct 134 ms 760 KB Output is correct
8 Correct 92 ms 504 KB Output is correct
9 Correct 140 ms 632 KB Output is correct
10 Correct 96 ms 504 KB Output is correct