-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path384a.cpp
More file actions
38 lines (35 loc) · 674 Bytes
/
384a.cpp
File metadata and controls
38 lines (35 loc) · 674 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
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n%2 == 0) {
string s(n, '.');
string t(n, '.');
for (int i = 0; i < n; i += 2) {
s[i] = 'C';
t[i+1] = 'C';
}
cout << n*n/2 << endl;
for (int i = 0; i < n; i += 2) {
cout << s << endl;
cout << t << endl;
}
}
else {
string s(n, '.');
string t(n, '.');
for (int i = 0; i < n-1; i += 2) {
s[i] = 'C';
t[i+1] = 'C';
}
s[n-1] = 'C';
cout << n*(n/2) + (n+1)/2 << endl;
for (int i = 0; i < n-1; i += 2) {
cout << s << endl;
cout << t << endl;
}
cout << s << endl;
}
return 0;
}