fork(6) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int MAIN()
  5. {
  6. int n, m;
  7. cin >> n >> m;
  8. for(int i = 1; i <= n; i++)
  9. {
  10. for(int j = 1; j <= m; j++)
  11. {
  12. bool haveSnake = false;
  13. if(i % 2 == 1) haveSnake = true;
  14. else
  15. {
  16. if(i % 4 == 2) haveSnake = (j == m);
  17. if(i % 4 == 0) haveSnake = (j == 1);
  18. }
  19. cout << (haveSnake ? "#" : ".");
  20. }
  21. cout << endl;
  22. }
  23. return 0;
  24. }
  25.  
  26. int main()
  27. {
  28. #ifdef LOCAL_TEST
  29. freopen("in.txt", "r", stdin);
  30. freopen("out.txt", "w", stdout);
  31. #endif
  32. ios :: sync_with_stdio(false);
  33. cout << fixed << setprecision(16);
  34. return MAIN();
  35. }
  36.  
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
Standard output is empty