This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
/*
6 6
++++--
++++--
------
------
--++++
--++++
8 8
+++++---
+++++---
+++++---
--------
--------
---+++++
---+++++
---+++++
7 7
++++---
++++---
++++---
---+---
---++++
---++++
---++++
*/
void solve() {
int n, m;
cin >> n >> m;
if (n == 1) {
cout << "1\n+\n";
return;
}
if (n == 2) {
cout << "2\n++\n++\n";
return;
}
if (n % 2 == 1) {
cout << 2 * n - 2;
}
else {
cout << 2 * n - 4;
}
cout << '\n';
for (int i = 0; i < (n - 1) / 2; i++) {
for (int j = 0; j < n / 2 + 1; j++) {
cout << '+';
}
for (int j = n / 2 + 1; j < n; j++) {
cout << '-';
}
cout << '\n';
}
for (int i = 0; i < 2 - n % 2; i++) {
for (int j = 0; j < n; j++) {
cout << '-';
}
cout << '\n';
}
for (int i = 0; i < (n - 1) / 2; i++) {
for (int j = 0; j < (n - 1) / 2; j++) {
cout << '-';
}
for (int j = (n - 1) / 2; j < n; j++) {
cout << '+';
}
cout << '\n';
}
}
int main() {
int t;
cin >> t;
while (t--) {
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... |