张江鹏 • 11个月前
#include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
bool cd1 = (i == j);
bool cd2 = (j == (N - i - 1));
if (cd1 || cd2) cout << '+';
else cout << '-';
}
cout << endl;
}
}
评论: