为什么不对啊(c++)(全wa)
  • 板块P1146 硬币翻转
  • 楼主zt17
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/5/8 08:28
  • 上次更新2023/10/28 01:56:39
查看原帖
为什么不对啊(c++)(全wa)
677553
zt17楼主2022/5/8 08:28

RT,为此我还下载了一次案例:

(0分)Code:

#include <bits/stdc++.h>
using namespace std;

const int N=102;
int a[N+1];

int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        for (int j=1;j<=n;j++)
        {
            if (j != i)
            {
                if (a[j]) a[j] = 0;
                else a[j] = 1;
            }
        }
        for (int j=1;j<=n;j++)
        {
            cout << a[j];
        }
        cout << endl ;
    }
    return 0;
}
2022/5/8 08:28
加载中...