#include <bits/stdc++.h>
#define ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 100005;
void solve();
int a1, a2, t, n, m;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> t;
while ( t-- ) {
cin >> n >> m;
if (n == 1 or m == 1) {
if (n >= m) {
cout << n << "\n";
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
cout << "+";
}
cout << "\n";
}
}
else {
cout << m << "\n";
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
cout << "-";
}
cout << "\n";
}
}
}
else if (n >= m) {
cout << n + ((m - 1) / 2) << "\n";
for (int i = 1; i <= n; ++i) {
a1 = (n / 2) + 1;
for (int j = 1; j <= m; ++j) {
if (a1 >= 1) {
cout << "+";
a1--;
}
else cout << "-";
}
cout << "\n";
}
}
else {
a1 = (n / 2) + 1;
cout << m + ((n - 1) / 2) << "\n";
for (int i = 1; i <= n; ++i) {
if (a1 >= 1) {
for (int j = 1; j <= m; ++j) cout << "-";
a1--;
}
else {
for (int j = 1; j <= m; ++j) cout << "+";
}
cout << "\n";
}
}
cout << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
in the table A+B is not equal to 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
1228 KB |
in the table A+B is not equal to 107 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
1228 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |