-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coder.cpp
60 lines (55 loc) · 900 Bytes
/
Coder.cpp
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
// Rodrigo Farias de Macêdo
#include <string>
#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <sstream>
#include <cctype>
#include <algorithm>
#include <utility>
#include <iterator>
#include <math.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
using namespace std;
int main(){
int n;
bool x = true;
cin >> n;
if(n%2 == 0){
cout << (n*n)/2 << endl;
for(int i = 0; i < n; i++){
string s = "";
for(int j = 0; j<n; j++){
if(x){
s = s + "C";
x = false;
}else{
s = s + ".";
x = true;
}
}
if(x) x = false;
else x = true;
cout << s << endl;
}
}else{
cout << (n*n)/2 +1 << endl;
for(int i = 0; i < n; i++){
string s = "";
for(int j = 0; j<n; j++){
if(x){
s = s + "C";
x = false;
}else{
s = s + ".";
x = true;
}
}
cout << s << endl;
}
}
return 0;
}