T=int(input())
for h in range (T):
v,g=[],[]
N,M=list(map(int,input().split()))
if N>1:
A=N
else :
A=0
if M%2==0 and M!=0:
B=M/2+1
else :
B=int(M/2)
print(A+B)
for i in range (N):
for j in range (M):
g.append('+')
v.append(g)
g=[]
if M%2==0 and N%2==0:
for uu in range(0,int(M/2)+1):
for rr in range(int((len(v))/2)-1):
v[uu][rr]='-'
elif M%2==1 and N%2==1:
for hh in range(0,int(M/2)):
for ll in range(int((len(v))/2)+1):
v[ll][hh]='-'
elif M%2==0 and N%2==1:
for ol in range(int(N/2)+1):
for op in range (int(M/2)):
v[ol][op]='-'
elif M%2==1 and N%2==0:
for mol in range(int(N/2)+1):
for omp in range(int(N/2)):
v[mol][omp]='-'
for j1 in range(len(v)):
for i1 in range(len(v[0])):
print(v[j1][i1],end=' ')
print()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
2892 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
14 ms |
3020 KB |
Execution failed because the return code was nonzero |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
2892 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
663 ms |
5224 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
651 ms |
5228 KB |
Expected integer, but "37.0" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
2892 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |