大佬!0分玄关!!!
查看原帖
大佬!0分玄关!!!
1094739
Urbosa楼主2024/12/6 15:29
#include <bits/stdc++.h>
using namespace std;
long long n, cnt = 2, t = 0;

int main() {
	cin >> n;
	for (long long i = 1; i <= n; i++) {
		for (long long j = 1; j <= n; j++) {
			if (j == 1 || j == n) {
				cout << "+";
				continue;
			} else if ((i >= 2 && i <= n - 1) || j == cnt) {
				cout << "+";
				t = 1;
				continue;
			} else {
				cout << "-";
				continue;
			}
		}
		if (t = 1) {
			cnt++;
			t = 0;
		}
		puts(" ");
	}
	return 0;
}

求求了,真不知道错哪(哭)

TAT

2024/12/6 15:29
加载中...