#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin>>n;
int k,l;
int a[n*2+5];
for(int i=1;i<=n;i++){
cin>>a[2*i-1];
cin>>a[2*i];
}
for(int i=1;i<=n;i++){
k=min(a[2*i],a[2*i-1]);
l=max(a[2*i],a[2*i-1]);
k=k-1;
k=k/2;
l=k+l;
cout<<l<<"\n";
if(a[2*i]<=a[2*i-1]){
for(int j=1;j<=a[2*i-1];j++){
for(int h=1;h<=k;h++){
cout<<"-";
}
for(int r=1;r<=a[2*i]-k;r++){
cout<<"+";
}
cout<<"\n";
}
}
else{
for(int d=1;d<=k;d++){
for(int g=1;g<=a[2*i];g++){
cout<<"+";
}
cout<<"\n";
}
for(int e=1;e<=a[2*i-1]-k;e++){
for(int t=1;t<=a[2*i];t++){
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 |
2 ms |
372 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 |
2 ms |
372 KB |
Output is correct |
4 |
Incorrect |
3 ms |
364 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
1408 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 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 |
2 ms |
372 KB |
Output is correct |
4 |
Incorrect |
3 ms |
364 KB |
Wrong answer in test 5 29: 31 < 32 |