可以不用数组
查看原帖
可以不用数组
1751052
unlucking楼主2025/6/21 14:07
#include<iostream>
using namespace std;
int main(){
    int n;cin >> n;
    int c = 0,flog = 1;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++){
            while(c == 0){//防止他从1开始,当c!=0时跳出
                cin >> c;
                flog = !flog;
            }
            cout << flog;
            c--;
        }
        cout <<endl;
    }
    return 0;
}
2025/6/21 14:07
加载中...