#include <iostream>
using namespace std;
int main(){
int k, m, n;
cin >> k;
int sol[k];
for(int i = 0; i < k; i++){
cin >> m >> n;
if(m == 1 or n == 1){
sol[i] = 0;
}
else if(m < n){
sol[i] = (m-1)*2;
}
else{
sol[i] = (n-1)*2;
}
}
for(int i = 0; i < k; i++){
cout << sol[i] << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
151 ms |
656 KB |
Output is correct |
7 |
Correct |
177 ms |
1016 KB |
Output is correct |
8 |
Correct |
123 ms |
632 KB |
Output is correct |
9 |
Correct |
179 ms |
964 KB |
Output is correct |
10 |
Correct |
126 ms |
632 KB |
Output is correct |