-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path245.cpp
More file actions
39 lines (36 loc) · 687 Bytes
/
Copy path245.cpp
File metadata and controls
39 lines (36 loc) · 687 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
#include <iostream>
bool dalton() {
int brothers;
std::cin >> brothers;
if(brothers == 0) return false;
long long int bro, aux;
char up = 'a';
std::cin >> bro;
for(int i = 1; i < brothers; i++) {
std::cin >> aux;
if(aux == bro) {
up = 'b';
} else if(aux < bro) {
if(up == 'u') up = 'b';
else up = 'd';
} else if(aux > bro) {
if(up == 'd') up = 'b';
else up = 'u';
}
if(up == 'b') {
std::cin.ignore(1024, '\n');
break;
}
bro = aux;
}
if(up == 'b') {
std::cout << "DESCONOCIDOS\n";
} else {
std::cout << "DALTON\n";
}
return true;
}
int main() {
while(dalton());
return 0;
}