#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,t;
bool tr1, tr2;
int main(){
cin>>t;
while(t--){
cin>>a>>b;
tr1 = true;
if(a == 1 or b == 1){
cout<<max(a, b)<<endl;
if(a == 1) for(int i=1; i <= b; i++) cout<<'+';
if(b == 1) for(int i=1; i <= a; i++) cout<<'-'<<endl;
}
else{
cout<<a + b - 2<<endl;
for(int i=1; i <= a; i++){
if(i == a){
for(int j=1; j <= b; j++) cout<<'-';
}
else{
cout<<'+';
if(tr1 == true){
tr2 = true;
for(int j=2; j <= b; j++){
if(tr2 == true){
cout<<'-';
tr2 = false;
continue;
}
else{
cout<<'+';
tr2 = true;
}
}
tr1 = false;
}
else{
tr2 = false;
for(int j=2; j <= b; j++){
if(tr2 == false){
cout<<'+';
tr2 = true;
continue;
}
else{
cout<<'-';
tr2 = false;
}
}
tr1 = true;
}
}
cout<<endl;
}
}
}
}
//DONE
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
348 KB |
in the table A+B is not equal to 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
1392 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1228 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 |
344 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |