thliup @ 2023-12-13 14:20:35
#include<iostream>
using namespace std;
#include<iomanip>
#include<cmath>
#include<algorithm>
int main(){ int a[1000000] = { 0 };
int n;
cin >> n;
int t, i, p = 0, ans = 0, k = 0;
while (cin >> t) {
for (i = 1 + p; i <= t + p; i++) {
a[i] = k;
}
p = i;
k = 1 - k;
}
for (i = 1; i <= n * n; i++) {
ans++;
cout << a[i];
if (ans == n) {
cout << endl;
ans = 0;
}
}
return 0;
}
by _IceCream_ @ 2023-12-13 14:37:29
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int t, i, p = 0, ans = 0, k = 0;
int a[1000000] = { 0 };
int n;
int main(){
cin >> n;
while (cin >> t) {
for (i = 1 + p; i <= t + p; i++) {
a[i] = k;
}
p += t;
k = 1 - k;
}
for (i = 1; i <= n * n; i++) {
ans++;
cout << a[i];
if (ans == n) {
cout << endl;
ans = 0;
}
}
return 0;
}
变量
by _IceCream_ @ 2023-12-13 14:37:57
@Vlixel 口误,
by thliup @ 2023-12-14 19:23:28
@Vlixel 为什么啊,等于i为什么错呢?谢谢