#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define all(x) x.begin(),x.end()
#define al(a,n) (a,a+n)
#define se second
#define fr first
#define m_p make_pair
using namespace std;
typedef long long ll;
const ll N = 2000004;
const ll mod = 1000 * 1000 * 100 + 7;
const ll inf = 1000000009;
ll n, m, k, z, t, x, y,a[1006][1006], ans;
int calc(int w)
{
int q=0;
while (w > 1)
{
q += w / 2;
w /= 2;
}
return q;
}
int main()
{
cin >> t;
while (t--)
{
cin >> x >> y;
for (int i = 1000; i >= 0; --i)
for (int j = 100; j >= 0; --j)
a[i][j] = 0;
if (x < y)
{
map <ll, ll> mp,mpp;
cout << y + calc(x-1) && (x==y==24)<< endl;
int j = 0,jj=0;
for (int i = 0; i < x; ++i)
{
j = jj;
while (a[i][j] == 0)
{
if (mp[j] < (x - 1) / 2 && mpp[i] < y / 2 + 1)
{
a[i][j] = 1;
mp[j]++;
mpp[i]++;
jj = (j+1)%y;
}
else
a[i][j] = 2;
j++;
j %= y;
}
}
}
else
{
cout << x + calc(y - 1) && (x == y == 24) << endl;
map <ll, ll> mp, mpp;
int i = 0,ii=0;
for (int j = 0; j < y; ++j)
{
i = ii;
while(a[i][j]==0)
{
if (mp[j] < x / 2 + 1 && mpp[i] < (y - 1) / 2)
{
a[i][j] = 2;
mp[j]++;
mpp[i]++;
ii = (i+1)%x;
}
else
a[i][j] = 1;
i++;
i %= x;
}
}
}
for (int i = 0; i < x; ++i)
{
for (int j = 0; j < y; ++j)
if (a[i][j] == 1)
cout << '+';
else
cout << '-';
cout << endl;
}
}
return 0;
}
Compilation message
stones.cpp: In function 'int main()':
stones.cpp:48:34: warning: comparison of constant '24' with boolean expression is always false [-Wbool-compare]
48 | cout << y + calc(x-1) && (x==y==24)<< endl;
| ~~~~^~~~
stones.cpp:48:31: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
48 | cout << y + calc(x-1) && (x==y==24)<< endl;
| ~^~~
stones.cpp:48:39: error: invalid operands of types 'bool' and '<unresolved overloaded function type>' to binary 'operator<<'
48 | cout << y + calc(x-1) && (x==y==24)<< endl;
| ~~~~~~~~~~^~~~~~~
stones.cpp:72:39: warning: comparison of constant '24' with boolean expression is always false [-Wbool-compare]
72 | cout << x + calc(y - 1) && (x == y == 24) << endl;
| ~~~~~~~^~~~~
stones.cpp:72:34: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
72 | cout << x + calc(y - 1) && (x == y == 24) << endl;
| ~~^~~~
stones.cpp:72:46: error: invalid operands of types 'bool' and '<unresolved overloaded function type>' to binary 'operator<<'
72 | cout << x + calc(y - 1) && (x == y == 24) << endl;
| ~~~~~~~~~~~~~~~^~~~~~~