-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyeet.cpp
198 lines (172 loc) · 4.41 KB
/
yeet.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#include <iostream>
#include <vector>
#include <string>
bool isprime(int n){
for(int i = 2; i <= n/2; i++){
if(n % i == 0){
return false;
}
}
return true;
}
unsigned long long int primorial(int n){
unsigned long long int prim = 1;
for(int i = 1; i <= n; i++){
if(isprime(i) == true){
prim *= i;
}
}
return prim;
}
char ouija[3][13] = {
{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'},
{'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '!', '?'}
};
struct AlienLifeForm
{
char name[50];
unsigned int id;
unsigned int weight;
unsigned int length;
unsigned int speed;
unsigned int tentacles;
unsigned int color[4];
bool sentient;
bool carnivore;
};
int len(char *str){
int pos = 0;
while(str[pos] != 0){
pos++;
}
return pos;
}
long long wow(AlienLifeForm alien){
return (alien.carnivore == 1 ? 5 : 1) * (alien.sentient == 1 ?
len(alien.name) * 126 + alien.length * 5 + alien.tentacles * 97 + alien.color[0] * 4 + alien.color[1] * 4 + alien.color[2] * 30 + alien.color[3] * 138 - alien.weight * 2 - alien.speed * 5 :
len(alien.name) * 23 + alien.weight * alien.speed * 52 + alien.length * 27 + alien.tentacles * 5 + alien.color[0] * 75 + alien.color[1] * 2 - alien.color[3] * 27) / (alien.carnivore == 0 ? 3 : 1);
}
int compare (AlienLifeForm a, AlienLifeForm b){
long long wowa = wow(a);
long long wowb = wow(b);
return wowa < wowb ? -1 : wowa == wowb ? 0 : 1;
}
void message(int i_start, int j_start, int length){
std::vector<char> str;
str.push_back(ouija[i_start][j_start]);
int h;
int w;
for(int n = 0; n < length - 1; n++){
std::cin >> h >> w;
i_start += h;
j_start += w;
if(i_start > 2 || i_start < 0 || j_start > 12 || j_start < 0){
std::cout << "THE SPIRITS ARE RESTLESS";
return;
}else{
str.push_back(ouija[i_start][j_start]);
}
}
for(int i = 0; i < length; i++){
std::cout << str[i];
}
}
int main(){
std::string board1;
std::getline(std::cin, board1);
std::string board2;
std::getline(std::cin, board2);
std::string board3;
std::getline(std::cin, board3);
std::string board = board1 + board2 + board3;
for(int i = 0; i < 3; i++){
if(board[i*3] + board[i*3 + 1] + board[i*3 + 2] == 'x' + 'x' + ' '){
// std::cout << "line" << i << std::endl;
board[i*3] = 'x';
board[i*3 + 1] = 'x';
board[i*3 + 2] = 'x';
}
}
for(int i = 0; i < 3; i++){
if(board[i] + board[i+3] + board[i+6] == 'x' + 'x' + ' '){
// std::cout << "column" << i << std::endl;
board[i] = 'x';
board[i+3] = 'x';
board[i+6] = 'x';
}
}
if(board[0] + board[4] + board[8] == 'x' + 'x' + ' '){
board[0] = 'x';
board[4] = 'x';
board[8] = 'x';
}else if(board[2] + board[4] + board[6] == 'x' + 'x' + ' '){
board[2] = 'x';
board[4] = 'x';
board[6] = 'x';
}
for(int h = 0; h < 3; h++){
for(int w = 0; w < 3; w++){
std::cout << board[3*h + w];
}
std::cout << std::endl;
}
}
/*
int main()
{
int n;
std::cin >> n;
AlienLifeForm zoo[100];
for (int i = 0; i < n; i++)
std::cin >> zoo[i].name >> zoo[i].id >> zoo[i].weight
>> zoo[i].length >> zoo[i].speed >> zoo[i].tentacles
>> zoo[i].color[0] >> zoo[i].color[1] >> zoo[i].color[2] >> zoo[i].color[3]
>> zoo[i].sentient >> zoo[i].carnivore;
for (int i = 0; i < n; i++)
for (int j = 0; j < n - i - 1; j++)
if (compare(zoo[j], zoo[j + 1]) > 0)
{
AlienLifeForm tmp = zoo[j];
zoo[j] = zoo[j + 1];
zoo[j + 1] = tmp;
}
for (int i = 0; i < n; i++)
std::cout << zoo[i].name << " ";
std::cout << std::endl;
return 0;
}*/
/*
int main(){
char a[] = "as";
std::cout << len(a);
}*/
/*
int main(){
int n;
std::cin >> n;
int nums[120] = {0};
int input;
for(int i = 0; i < n - 1; i++){
std::cin >> input;
nums[input] = input;
}
for(int i = 1; i < n; i++){
if(nums[i] == 0){
std::cout << i;
break;
}
}
}*/
/*
int main(){
int n;
std::cin >> n;
int pos = 0;
int len;
for(int i = 0; i < n; i++){
std::cin >> len;
pos += i % 2 == 0 ? len : -len;
}
std::cout << pos << std::endl;
}*/