-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path1049 - Animal.js
61 lines (57 loc) · 1.12 KB
/
1049 - Animal.js
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
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var a, b, c, total;
a=String(lines.shift());
b=String(lines.shift());
c=String(lines.shift());
if(a === "vertebrado")
{
if(b === "ave")
{
if(c === "carnivoro")
{
total = String("aguia");
}
else if(c === "onivoro")
{
total = String("pomba");
}
}
else if(b === "mamifero")
{
if(c === "onivoro")
{
total = String("homem");
}
else if(c === "herbivoro")
{
total = String("vaca");
}
}
}
else if(a === "invertebrado")
{
if(b === "inseto")
{
if(c === "hematofago")
{
total = String("pulga");
}
else if(c === "herbivoro")
{
total = String("lagarta");
}
}
else if(b === "anelideo")
{
if(c === "hematofago")
{
total = String("sanguessuga");
}
else if(c === "onivoro")
{
total = String("minhoca");
}
}
}
console.log(total);