#include <bits/stdc++.h>
using namespace std;
void solve(){
int n, m;
cin >> n >> m;
if(n >= 3 && m >= 3){
if(n == 3 && m == 4){
cout << 5 << '\n';
cout << "----" << '\n';
cout << "----" << '\n';
cout << "++++" << '\n';
}
else{
int s = n;
char a[100][100];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
a[i][j] = '+';
}
}
if(n % 2 && m % 2){
s += m / 2;
for(int i = 0; i < n / 2 + 1; i++){
for(int j = 0; j <= m / 2 - 1; j++){
a[i][j] = '-';
}
}
}else if(n % 2 && m % 2 == 0){
s += m / 2 - 1;
for(int i = 0; i < n / 2 + 1; i++){
for(int j = 0; j < m / 2 - 1; j++){
a[i][j] = '-';
}
}
}else if(n % 2 == 0 && m % 2){
s += m / 2;
for(int i = 0; i < n / 2 + 1; i++){
for(int j = 0; j < m / 2; j++){
a[i][j] = '-';
}
}
} else{
s += n / 2 - 1;
for(int i = 0; i < n / 2 + 1; i++){
for(int j = 0; j < m / 2 - 1; j++){
a[i][j] = '-';
}
}
}
cout << s << '\n';
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << a[i][j];
}
cout << '\n';
}
}
} else{
if(n < m){
cout << m << '\n';
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << '-';
}
cout << '\n';
}
} else{
cout << n << '\n';
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << '+';
}
cout << '\n';
}
}
}
}
int main(){
int t;
cin >> t;
while(t--)
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Wrong answer in test 3 45: 25 < 46 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
2 ms |
204 KB |
Wrong answer in test 3 45: 25 < 46 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
1252 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
2 ms |
204 KB |
Wrong answer in test 3 45: 25 < 46 |