#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
#define N 200005
#define pb push_back
#define ff first
#define ss second
#define pp pop_back
#define sz(s) (int)s.size()
ll a[N], t, T, n, m;
int main () {
cin >> T;
while (T--) {
cin >> n >> m;
if (n == 1) {
cout << m << '\n';
for (int i = 1; i <= m; i++) {
cout <<"-";
}
cout << '\n';
continue;
}
else if (m == 1) {
cout << n << '\n';
for(int j=1;j<=n; j++){
for (int i = 1; i <= m; i++) {
cout << "+";
}
cout << '\n';
}
continue;
}
cout << n+m-2 << '\n';
for (int i = 1; i < n; i++) {
if (i % 2 != 0) {
for(int j = 1; j <= m; j++) {
if (j % 2 != 0 or j == m) {
cout<<"+";
}
else cout<<"-";
}
cout<<'\n';
continue;
}
for (int j = 1; j <= m; j++) {
if(j % 2 != 0 and j != m) cout<<"-";
else cout << "+";
}
cout << '\n';
}
for (int i = n; i > 0; i--) {
for (int j = 1; j <= m; j++) {
cout<<'-';
}
cout<<'\n';
break;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
in the table A+B is not equal to 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
in the table A+B is not equal to 20 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
in the table A+B is not equal to 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
1372 KB |
Output is correct |
2 |
Correct |
19 ms |
1316 KB |
Output is correct |
3 |
Correct |
18 ms |
1200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
1372 KB |
in the table A+B is not equal to 46 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
in the table A+B is not equal to 4 |
3 |
Halted |
0 ms |
0 KB |
- |