fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4.  
  5. int main() {
  6. int n, m; cin >> n >> m;
  7.  
  8. bool right = true;
  9. for (int i = 1; i <= n; i++) {
  10. if (i % 2 == 1) {
  11. for (int j = 1; j <= m; j++)
  12. cout << '#';
  13. }else {
  14. if (right) {
  15. for (int j = 1; j <= m-1; j++)
  16. cout << '.';
  17. cout << '#';
  18. }else {
  19. cout << '#';
  20. for (int j = 1; j <= m-1; j++)
  21. cout << '.';
  22. }
  23. right = !right;
  24. }
  25.  
  26. cout << endl;
  27. }
  28. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty