#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll t;cin>>t;
while(t--){
ll n,m;cin>>n>>m;
if(n>1 && m>1)cout<<2+(2*(min(n,m)-2))<<endl;
else cout<<0<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
72 ms |
384 KB |
Output is correct |
7 |
Correct |
110 ms |
680 KB |
Output is correct |
8 |
Correct |
74 ms |
456 KB |
Output is correct |
9 |
Correct |
108 ms |
556 KB |
Output is correct |
10 |
Correct |
73 ms |
496 KB |
Output is correct |