#include <bits/stdc++.h>
using namespace std;
int main () {
int y,m,n,sum,ans;
cin >> y;
for (int i=0;i<y;i++) {
cin >> n >> m;
if (n==1 || m==1) {
cout << 0 << endl;
} else {
sum=min(n,m);
for (int i=2;i<=sum;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 |
109 ms |
464 KB |
Output is correct |
7 |
Correct |
145 ms |
896 KB |
Output is correct |
8 |
Correct |
99 ms |
476 KB |
Output is correct |
9 |
Correct |
137 ms |
604 KB |
Output is correct |
10 |
Correct |
93 ms |
500 KB |
Output is correct |