Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Created July 6, 2015 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerioagjr/aa3113363660c524cbd2 to your computer and use it in GitHub Desktop.
Save rogerioagjr/aa3113363660c524cbd2 to your computer and use it in GitHub Desktop.
Campeonato
#include <cstdio>
int main(){
// declaro e leio os resultados dos times
int cv, ce, cs, fv, fe, fs, pc, pf;
scanf("%d %d %d %d %d %d", &cv, &ce, &cs, &fv, &fe, &fs);
// calculo os pontos obtidos por eles
pc=3*cv+ce;
pf=3*fv+fe;
// se algum tiver mais pontos, imprimo seu caractere
if(pc>pf) printf("C\n");
if(pc<pf) printf("F\n");
// se eles estiverem empatados nos pontos
if(pc==pf){
// se algum deles ganahr no saldo, mprimo seu caractere
if(cs>fs) printf("C\n");
if(cs<fs) printf("F\n");
// e imprimo '=' caso o empate persista
if(cs==fs) printf("=\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment