求助!!!答案错误
查看原帖
求助!!!答案错误
1190893
quanac_lcx楼主2025/2/7 14:23

试了n种方法,包括题解,都不对,求助!

#include<iostream>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i==j||i + j == n + 1) cout<<"+";//???
            else cout<<"-";
        }
        cout<<endl;
    }
    return 0;
}


输入5,输出

+----
-+---
--+-+
---+-
--+-+
2025/2/7 14:23
加载中...