#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int Solve(int n, int m) {
return 2 * min(n, m) - 2;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int k;
cin >> k;
for(int i = 0; i < k; i++) {
int n, m;
cin >> n >> m;
cout << Solve(n, m) << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
528 KB |
Output is correct |
6 |
Correct |
14 ms |
1200 KB |
Output is correct |
7 |
Correct |
18 ms |
2116 KB |
Output is correct |
8 |
Correct |
13 ms |
2392 KB |
Output is correct |
9 |
Correct |
20 ms |
3084 KB |
Output is correct |
10 |
Correct |
13 ms |
3452 KB |
Output is correct |