이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;
#define gcd __gcd
void solve() {
ll a,b;
cin >> a >> b;
if (a>=b){
if (b==2){
cout << a << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b; i++){
cout << '+';
}
cout << "\n";
}
}else{
cout << a+(b/2);
cout << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b-(b/2); i++){
cout << '+';
}
for (int i = 0; i < (b/2); i++){
cout << '-';
}
cout << "\n";
}
}
}else if (a<b){
if (a==2){
cout << b << "\n";
for (int i = 0; i < a; i++){
for (int i = 0; i < b; i++){
cout << '-';
}
cout << "\n";
}
}else{
cout << b+(a/2);
cout << "\n";
for (int i = 0; i < a-(a/2); i++){
for (int i = 0; i < b; i++){
cout << '-';
}
cout << "\n";
}
for (int i = 0; i < (a/2); i++){
for (int i = 0; i < b; i++)cout << '+';
cout << "\n";
}
}
}
}
int main() {
cin.tie(0)->sync_with_stdio(false);
#ifdef null
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int q = 1;
cin >> q;
while (q--) {
solve();
}
}
# | 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... |