#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,t;
int main(){
cin>>t;
while(t--){
cin>>a>>b;
if(a < 3 or b < 3) cout<<max(a, b)<<endl;
if(a >= 3 and b >= 3){
if(a == b) cout<<a + b - 2;
else{
if(max(a, b) % min(a, b) == 0) cout<<max(a, b) - (max(a, b) - min(a, b));
else cout<<max(a, b) - (max(a, b) - min(a, b)) + 1;
}
cout<<endl;
for(int i=1; i <= (a / 2); i++){
for(int j=1; j <= b; j++){
if(j <= ((b / 2) + 1)) cout<<"+";
else cout<<"-";
}
cout<<endl;
}
for(int i=1; i <= 1; i++){
for(int j=1; j <= b; j++){
if(j == ((b / 2) + 1)) cout<<"+";
else cout<<"-";
}
}
cout<<endl;
for(int i=1; i <= (a / 2); i++){
for(int j=1; j <= b; j++){
if(j >= ((b / 2) + 1)) cout<<"+";
else cout<<"-";
}
cout<<endl;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
in the table A+B is not equal to 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
1264 KB |
in the table A+B is not equal to 22 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
1360 KB |
in the table A+B is not equal to 46 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |