Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void init()
- {
- int T;
- cin >> T;
- while (T--)
- {
- int n, m;
- cin >> n >> m;
- string al = "10";
- for (int i = 0; i < n; i++)
- {
- if (i == 0 )
- {
- if (m & 1)
- {
- for (int i = 0; i < (m - 1) / 2; i++)
- cout << al;
- cout << "1" << endl;
- }
- else
- {
- for (int i = 0; i < m / 2; i++)
- cout << al;
- cout << endl;
- }
- }
- else if (i & 1)
- {
- cout << string(m, '0') << endl;
- }
- else if (!(i & 1) and i != n - 1)
- {
- cout << "1";
- for (int i = 0; i < m - 2; i++)
- cout << "0";
- cout << "1" << endl;
- }
- else
- {
- if (m & 1)
- {
- for (int i = 0; i < (m - 1) / 2; i++)
- cout << al;
- cout << "1" << endl;
- }
- else
- {
- for (int i = 0; i < m / 2; i++)
- cout << al;
- cout << endl;
- }
- }
- }
- if(T!=0) cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement