#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 100000000000000000
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp push
typedef long long ll;
using namespace std;
int main(){
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
int test;
cin >> test;
while(test--){
int n,m;
cin >> n >> m;
cout << max(n,m)+min(n,m)-((min(n,m)/2)+1) << '\n';
if(n>m){
for(int i=1;i<=n;i++){
for(int j=1;j<=(m/2)+1;j++){
cout << '+';
}
for(int j=(m/2)+2;j<=m;j++){
cout << '-';
}
cout << '\n';
}
}
else{
for(int i=1;i<=(n/2)+1;i++){
for(int j=1;j<=m;j++){
cout << '-';
}
cout << '\n';
}
for(int i=(n/2)+2;i<=n;i++){
for(int j=1;j<=m;j++){
cout << '+';
}
cout << '\n';
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
2 ms |
364 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
35 ms |
1388 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
1388 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
2 ms |
364 KB |
Wrong answer in test 5 29: 31 < 32 |