fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int m,n;
  6. cin>>n>>m;
  7. for(int i=1;i<m+1;i++)
  8. {
  9. for(int j=1;j<n+1;j++)
  10. {
  11. if( ((i%2==0) && ((j+3)%4==0))||((i%2!=0) && ((j+1)%4==0)))
  12. {
  13. cout<< "1";
  14. }
  15. if ((j+3-i%2*2)%4!=0)
  16. {
  17. cout<<((j+i%2*2)%4==0?"2":"+");
  18. }
  19. }
  20. cout<<endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3460KB
stdin
7 7
stdout
+21++21
1++21++
+21++21
1++21++
+21++21
1++21++
+21++21