#include<bits/stdc++.h>
using namespace std;
#define ll long long
char arr[1005][1005];
void fun(){
bool boo = 0;
ll n, m;
cin>>n>>m;
if(n > m)swap(n, m), boo = 1;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
arr[i][j] = (boo ? '+' : '-');
cout<<max(n, m) + min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1))<<endl;
for(int i = 1, last = 1; i <= min(min(n, m), (min(n, m) / 2 - !(min(n, m) & 1)) * max(n, m) / (max(n, m) / 2 + 1)); i++){
for(int j = 1; j <= m / 2 + 1; j++, last++){
if(last == m + 1)last = 1;
arr[i][last] = (boo ? '-' : '+');
}
}
if(!boo){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++)
cout<<arr[i][j];
cout<<"\n";
}
}
else{
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++)
cout<<arr[i][j];
cout<<"\n";
}
}
cout<<"\n";
}
int main(){
int ttt = 1;
cin>>ttt;
while(ttt--)fun();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
312 KB |
in the table A+B is not equal to 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
1336 KB |
invalid character |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
1324 KB |
Output is correct |
2 |
Correct |
24 ms |
1788 KB |
Output is correct |
3 |
Correct |
22 ms |
1580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
invalid character |
3 |
Halted |
0 ms |
0 KB |
- |