You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
836 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 11;
int a[N] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
void print() {
int s = 0;
for (int i = 1; i < N; i++) {
s += a[i];
cout << s % 2 << " ";
}
cout << "\n";
}
int main() {
/*
01++ <=> 01++
[l,r] => a[l]++,a[r+1]++
a[k] => sum(a[1~k])%2
*/
//将2-4取反
a[2]++, a[4 + 1]--;
print();
//将2-4再取一次反
a[2]++, a[4 + 1]--;
print();
//将3-4再取一次反
a[3]++, a[4 + 1]--;
print();
return 0;
}
/*
0 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0
*/