이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,t;
bool tr1, tr2;
int main(){
cin>>t;
while(t--){
cin>>a>>b;
tr1 = true;
if(a == 1 or b == 1){
cout<<max(a, b)<<endl;
if(a == 1) for(int i=1; i <= b; i++) cout<<'+';
if(b == 1) for(int i=1; i <= a; i++) cout<<'-'<<endl;
}
else{
cout<<a + b - 2<<endl;
for(int i=1; i <= a; i++){
if(i == a){
for(int j=1; j <= b; j++) cout<<'-';
}
else{
cout<<'+';
if(tr1 == true){
tr2 = true;
for(int j=2; j <= b; j++){
if(tr2 == true){
cout<<'-';
tr2 = false;
continue;
}
else{
cout<<'+';
tr2 = true;
}
}
tr1 = false;
}
else{
tr2 = false;
for(int j=2; j <= b; j++){
if(tr2 == false){
cout<<'+';
tr2 = true;
continue;
}
else{
cout<<'-';
tr2 = false;
}
}
tr1 = true;
}
}
cout<<endl;
}
}
}
}
//DONE
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |