Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Uri/beecrowd problem no - 1131 solution in C

#include<stdio.h>
int main(){
    int limit = 1,counter = 0,counter1 = 0,counter2 = 0,counter3 = 0;
    while(limit != 2){
        if(limit == 1){
            int score1,score2;
            scanf("%d%d", &score1, &score2);
            if(score1 > score2){
                counter1++;
            }else{
                counter2++;
            }
            if(score1 == score2){
                counter3++;
            }
        }
        printf("Novo grenal (1-sim 2-nao)
");
        counter++;
        scanf("%d", &limit);
    }
    printf("%d grenais
", counter);
    printf("Inter:%d
", counter1);
    printf("Gremio:%d
", counter2);
    printf("Empates:%d
", counter3);
    if(counter1 > counter2){
        printf("Inter venceu mais
");
    }
    if(counter1 < counter2){
        printf("Gremio venceu mais
");
    }
    if(counter2 == counter1){
        printf("Não houve vencedor
");
    }
    return 0;
}
Source by www.beecrowd.com.br #
 
PREVIOUS NEXT
Tagged: #problem #solution #C
ADD COMMENT
Topic
Name
6+1 =