Advertisement
Guest User

panic

a guest
Oct 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define forn(i, n) for (int i = 0; i<(int)n; ++i)
  3. #define rfor(i, n) for (int i = n-1; i>=0; --i)
  4. #define rmod(x, y) (((x%y)+y)%y)
  5. using namespace std;
  6. typedef vector<int>::iterator vit;
  7. typedef unsigned int uint;
  8. typedef unsigned short ushort;
  9. typedef long long ll;
  10. const int MAXN = 1024;
  11.  
  12. //OPERATORS
  13.  
  14.  
  15. //GLOBALS
  16.  
  17.  
  18. //FUNCTIONS
  19.  
  20.  
  21. int main()
  22. {
  23. ios::sync_with_stdio(0);
  24. cin.tie(0);
  25. int n ; cin >> n;
  26. int lo = 1, hi = 2*n-1;
  27. for(int i = 1; i<= 2*n-1; i++){
  28. for(int j = 1; j <= 2*n-1; j++){
  29. if(j == lo || j == hi || i == n || j == n) cout << n;
  30. else cout << " ";
  31. }
  32. cout << endl;
  33. lo++;
  34. hi--;
  35. }
  36.  
  37.  
  38. return 0;
  39. }
  40.  
  41.  
  42. ///DOS
  43.  
  44. #include <bits/stdc++.h>
  45. #define forn(i, n) for (int i = 0; i<(int)n; ++i)
  46. #define rfor(i, n) for (int i = n-1; i>=0; --i)
  47. #define rmod(x, y) (((x%y)+y)%y)
  48. using namespace std;
  49. typedef vector<int>::iterator vit;
  50. typedef unsigned int uint;
  51. typedef unsigned short ushort;
  52. typedef long long ll;
  53. const int MAXN = 1024;
  54.  
  55. //OPERATORS
  56.  
  57.  
  58. //GLOBALS
  59.  
  60.  
  61. //FUNCTIONS
  62.  
  63.  
  64. int main()
  65. {
  66. ios::sync_with_stdio(0);
  67. cin.tie(0);
  68. int n ; cin >> n;
  69. int lo = n,hi = n;
  70. for(int i = 1; i < 2*n; i++){
  71. for(int j =1; j < 2*n ; j++){
  72. if(j == lo || j == hi || i == n || j == n) cout << n;
  73. else cout << " ";
  74. }
  75. if(i <n){
  76. hi--;
  77. lo++;
  78. }
  79. else{
  80. hi++;
  81. lo--;
  82. }
  83. cout << endl;
  84. }
  85.  
  86.  
  87.  
  88. return 0;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement