Uri/BEE CROWD 1131 Problem solution || Uri problem solutions || BEECROWD 1131 Grenais Solution in C, C++, Python || Beecrowd 1131 Solution
Uri/BEE CROWD 1131 Problem solution in C,C++, Python
Question & Submit :
Beecrowd 1131 Question:
The Federação Gaúcha de Futebol invited you to write a program to present a statistical result of several GRENAIS. Write a program that read the number of goals scored by Inter and the number of goals scored by Gremio in a GRENAL. Write the message “Novo grenal (1-sim 2-nao)” and request a response. [Uri problem solution]
– How many GRENAIS were part of the statistics.
– 1.The number of victories of Inter.
– 2.The number of victories of Gremio.
– 3.The number of Draws.
– A message indicating the team that won the largest number of GRENAIS (or the message: “Não houve vencedor” if both team won the same quantity of GRENAIS).
Input
The input contains two integer values, corresponding to the goals scored by both teams.
Output
After each reading of the goals, the message “Novo grenal (1-sim 2-nao)” must be printed.
Input Sample | Output Sample |
3 2 1 2 3 1 3 1 2 | Novo grenal (1-sim 2-nao) Novo grenal (1-sim 2-nao) Novo grenal (1-sim 2-nao) 3 grenais Inter:2 Gremio:1 Empates:0 Inter venceu mais |
Uri/BEE CROWD 1131 Solution in Pyhon
def main():
inter = 0
gremio = 0
grenal = 0
em = 0
while True:
a, b = map(int, input().split())
if a > b:
inter += 1
elif a < b:
gremio += 1
else:
em += 1
grenal += 1
print("Novo grenal (1-sim 2-nao)")
op = int(input())
if op == 2:
break
print(f"{grenal} grenais")
print(f"Inter:{inter}") # No space after 'Inter:'
print(f"Gremio:{gremio}") # No space after 'Gremio:'
print(f"Empates:{em}") # No space after 'Empates:' //beecrowd 1131
if inter > gremio:
print("Inter venceu mais")
elif gremio > inter:
print("Gremio venceu mais")
else:
print("Nao houve vencedor")
if __name__ == "__main__":
main()
URI / BEE CROWD 1131 Grenais Solution In c
Uri-problem-solution In this code we use c language. Uri-problem-solution 1131 grenais .Don’t copy the code first try.
#include <stdio.h>
int main() {
int a, b, op;
int inter = 0;
int gremio = 0;
int grenal = 0;
int em = 0;
while (1) {
scanf("%d %d", &a, &b);
if (a > b) inter++;
else if (a < b) gremio++;
else em++;
grenal++;
printf("Novo grenal (1-sim 2-nao)\n");
scanf("%d", &op);
if (op == 2) break;
}
printf("%d grenais\n", grenal);
printf("Inter:%d\n", inter); // Ensure no extra space after 'Inter:'
printf("Gremio:%d\n", gremio); // Ensure no extra space after 'Gremio:'
printf("Empates:%d\n", em); // Ensure no extra space after 'Empates:'
if (inter > gremio)
printf("Inter venceu mais\n");
else if (gremio > inter)
printf("Gremio venceu mais\n");
else
printf("Nao houve vencedor\n");
return 0;
}
URI / BEE CROWD 1131 Grenais Solution in C++
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,op;
int inter=0;
int gremio=0;
int grenal=0;
int em=0;
while(true){
cin>>a>>b;
if(a>b)inter++;
if(a<b)gremio++;
if(a==b)em++;
grenal++;
cout<<"Novo grenal (1-sim 2-nao)\n";
cin>>op;
if(op==2)break;
}
cout << grenal <<" grenais\n";
cout << "Inter:" << inter << "\n";
cout << "Gremio:" << gremio << "\n"; //Uri problem solution
cout << "Empates:" << em << "\n";
if(inter > gremio) cout << "Inter venceu mais\n";
if(inter < gremio) cout << "Gremio venceu mais\n";
if(inter == gremio) cout << "Nao houve vencedor\n";
return 0;
}