-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1131.js
48 lines (43 loc) · 827 Bytes
/
1131.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
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
let number;
let [x, y] = lines.shift().split(" ");
let X = parseInt(x);
let Y = parseInt(y);
let Inter = 0;
let Gremio = 0;
let empates = 0;
let cont = 0;
let team;
while(true){
if(X == Y){
empates++;
}
else if(Y > X){
Gremio++;
}
else if(X > Y){
Inter++;
}
cont++;
console.log("Novo grenal (1-sim 2-nao)");
number = lines.shift();
if(number == 1){
}
else{
break;
}
[x, y] = lines.shift().split(" ");
X = parseInt(x);
Y = parseInt(y);
}
if(Inter > Gremio){
team = "Inter venceu mais";
}
else if(Inter < Gremio){
team = "Gremio venceu mais";
}
else{
team = "Não houve vencedor"
}
console.log(`${cont} grenais\nInter:${Inter}\nGremio:${Gremio}\nEmpates:${empates}\n${team}`);