#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();
ll 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 |
1 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 |
324 KB |
in the table A+B is not equal to 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
21 ms |
1316 KB |
in the table A+B is not equal to 107 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
1196 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
- |