runner_362 @ 2022-01-20 09:46:40
编译器测试过,全乱套
自己都看不懂是啥!
代码如下:
#include <iostream>
using namespace std;
int id[205];
int main() {
int n, cnt = 1;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> id[i];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= id[i]; j++) {
if (cnt != n) {
if (j % 2 == 1) {
cout << '0' << ' ';
} else {
cout << '1' << ' ';
}
} else {
cout << endl;
}
cnt++;
}
}
return 0;
}
感觉哪哪都不对,求助!
by cqazy811 @ 2022-01-20 09:50:35
@sean_coder 不是输入 n 个 id,是 id 的和等于
by zhanghaiyu @ 2022-01-20 09:50:48
#include<bits/stdc++.h>
using namespace std;int s,c,x;
int main(){
int n;
int a;
cin>>n;
while(c<n*n){
cin>>a;
s++;
for(int i=a;i>0;i-=1){
if(x==n){
cout<<"\n";
x-=x;
x*=0;
}
if(s%2==1)cout<<"0";
else cout<<"1";
x++;
c++;
}
}
return 0;
}
拿去拿去
by Zvelig1205 @ 2022-01-20 10:56:37
@sean_coder 乱了就重打一遍