-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1319.cpp
More file actions
68 lines (57 loc) · 1.25 KB
/
P1319.cpp
File metadata and controls
68 lines (57 loc) · 1.25 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* 压缩问题
*/
#include<iostream>
using namespace std;
int main() {
int n = 0, s = 0, a = 0, k = 0;
cin >> n;
int count = 0;
while (s < n * n) {
cin >> a;
k++; //判断输出1还是0
for (int j = a; j >= 1; j--) {
if (count == n) {
cout << endl;
count = 0;
}
if (k % 2 == 1) {
cout << 0;
} else {
cout << 1;
}
count++;
s++;
}
}
return 0;
/*int n = 0;
int a[250];
cin >> n;
for (int i = 1; i <= 2 * n; i++) {
cin >> a[i];
}
//交替输出0和1
int count = 0;
for (int i = 1; i <= 2*n; i++) {
if (i % 2 == 0) {
for (int j = 1; j <= a[i]; j++) {
count++;
cout << 1;
if (count == n) {
cout << endl;
count = 0;
}
}
} else {
for (int j = 1; j <= a[i]; j++) {
count++;
cout << 0;
if (count == n) {
cout << endl;
count = 0;
}
}
}
}*/
}