#include <bits/stdc++.h>
using namespace std;
int ans;
int main () {
int k=0;
cin>>k;
int n=0, m=0;
for (int i=0; i<k; i++) {
cin>>n>>m;
if (n==1 || m==1) {
cout << 0;
}
else {
int um=min(n, m);
for (int i=2; i<=um; i++) {
ans+=2;
}
cout << ans << endl;
ans=0;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
87 ms |
620 KB |
Output is correct |
7 |
Correct |
132 ms |
748 KB |
Output is correct |
8 |
Correct |
94 ms |
604 KB |
Output is correct |
9 |
Correct |
141 ms |
748 KB |
Output is correct |
10 |
Correct |
96 ms |
492 KB |
Output is correct |