-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1146.cpp
More file actions
46 lines (35 loc) · 720 Bytes
/
P1146.cpp
File metadata and controls
46 lines (35 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by YangYang on 2022/9/15.
//
#include <iostream>
using namespace std;
void getResult(int n, int a[]){
for (int i = 0; i < n; i++) {
//翻转除第i+1个数以外的数
for (int j = 0; j < n; j++) {
if (j != i) {
if (a[j] == 0) {
a[j] = 1;
} else {
a[j] = 0;
}
}
}
//输出
for (int k = 0; k < n; k++) {
cout << a[k];
}
cout<<endl;
}
}
int main() {
int n = 0;
int a[100]={};
cin >> n;
for (int i = 0; i < n; i++) {
a[i]=0;
}
cout<<n<<endl;
getResult(n,a);
return 0;
}