- 题解
3337
- @ 2026-9-22 16:45:42
#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 条评论
-
-
#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