fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define el "\n"
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define se second
  7. #define fi first
  8. #define be begin()
  9. #define en end()
  10. #define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
  11.  
  12. int main()
  13. {
  14. Faster;
  15. int n; cin >> n;
  16. int m = 2 * n - 1;
  17. int a[n][m] = {0};
  18. for(int i = 0; i < n; i++)
  19. {
  20. a[i][i] = 1;
  21. a[i][m - i - 1] = 1;
  22. }
  23. int j = m / 2, k = m / 2;;
  24. for(int i = 0; i < n; i++)
  25. {
  26. a[i][j--] = 1;
  27. a[i][k++] = 1;
  28. }
  29. for(int i = 0; i < n; i++)
  30. {
  31. for(int j = 0; j < m; j++)
  32. {
  33. if(a[i][j] == 1) cout << "$";
  34. else cout << "E";
  35. }
  36. cout << el;
  37. }
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0.01s 5292KB
stdin
5
stdout
$EEE$EEE$
E$E$E$E$E
EE$EEE$EE
E$E$E$E$E
$EEE$EEE$