#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int t;
cin >> t;
while(t--){
int n, m;
cin >> n >> m;
if(n<=m){
int e = (n-1)/2, e1;
cout << m+e << endl;
e1=e;
for(int i=0; i<n; i++){
if(e1!=0){
for(int j=0; j<m; j++)
cout << '+';
e1--;
}
else{
for(int j=0; j<m; j++)
cout << '-';
}
cout << endl;
}
}
else{
int e = (m-1)/2, e1;
cout << n+e << endl;
for(int i=0; i<n; i++){
e1 = e;
for(int j=0; j<m; j++){
if(e1!=0){
cout << '-'; e1--; }
else
cout << '+';
}
cout << endl;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Incorrect |
10 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
1236 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
1200 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Incorrect |
10 ms |
332 KB |
Wrong answer in test 5 29: 31 < 32 |