13012 – Identifying tea UVA Solution

This a is an easy problem from uva judge https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=4900

  • Just compare the tea Id with the 5 inputs.

Hints

  • Read until EOF.

Code

/*
*Author: Fabian Calsina
*Date: 25/12/2016
*/
#include<stdio.h>

int main(){

    int x, teaType, input, answer;

    while( scanf("%d", &teaType) != EOF ){
        answer = 0;
        for( x=0; x<5; x++ ){
            scanf("%d", &input);
            if(input == teaType)
                answer++;
        }

        printf("%d\n", answer);
    }
return 0;
}

Leave a comment