#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(){
int n, m;
cin >> n >> m;
if(n==1){
cout << m << endl;
for(int j=0; j<m; j++){
cout << "-";
}
}
else if(m==1){
cout << n << endl;
for(int i=0; i<n; i++){
cout << "+\n";
}
}
else if(n<m){
cout << n/2+n%2-1+(m+m%2-1-(n/2+n%2-1)) << endl;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(j<ceil(m/2)+m%2-1){
cout << "-";
}
else{
cout << "+";
}
}
cout << "\n";
}
}
else if(n>m){
cout << n+(m-n/2-n%2) << endl;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(j<ceil(m/2)+m%2-1){
cout << "-";
}
else{
cout << "+";
}
}
cout << "\n";
}
}
else{
cout << n+ceil(n/2)+n%2-1 << endl;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(j<ceil(m/2)+m%2-1){
cout << "-";
}
else{
cout << "+";
}
}
cout << "\n";
}
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
in the table A+B is not equal to 45 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
1228 KB |
in the table A+B is not equal to 69 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1228 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |