#include using namespace std;

int main() { int n; cin >> n; int m = 2 * n - 1; for (int i = 1; i <= m; i++) { for (int j = 1; j <= m; j++) { if (i + j == n + 1 || j - i == n - 1 || i - j == n - 1 || i + j == 3 * n - 1) { cout << '+'; } else { cout << '.'; } } cout << endl; } return 0; }

3 条评论

  • 依旧不加块级代码

    可恶

    • @ 2026-9-22 16:46:05

      #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int mid=n/2; for(int i=0; i<=n; i++){ for(int j=0; j<=n; j++){ if(abs(i-mid)+abs(j-mid)==mid){ cout<<'+'; } else { cout<<'.'; } } cout<<endl; } return 0; }

      • #include using namespace std;

        int main() { int n; cin >> n; int m = 2 * n - 1; for (int i = 1; i <= m; i++) { for (int j = 1; j <= m; j++) { if (i + j == n + 1 || j - i == n - 1 || i - j == n - 1 || i + j == 3 * n - 1) { cout << '+'; } else { cout << '.'; } } cout << endl; } return 0; }

        • 1