I can not count on a decision

0

I made the solution to the question Uri, Tourists of the Huacachina 27008 park , but the results are the same as those of the question however my solution fails in 20% of the tests and I do not know how to solve

#include <stdio.h>
#include <string.h>

int main(int argc, char** argv)
{
  char nome[100];
  int teste, ida=0,volta=0,c=0,c1 = 0;
  while(1)
  {
    scanf("%s", nome);
    if(0 == strcmp(nome, "ABEND"))
        break;
    scanf("%d", &teste);
    if(strcmp(nome, "SALIDA") == 0)
    {
        if(teste > 0)
        {
            ida += teste;
            c++;
        }
    }
    else if(0 == strcmp(nome, "VUELTA"))
    {
        if(teste > 0)
        {
            volta += teste;
            c1++;
        }
    }
   }
   printf("%d\n", ida - volta);
   printf("%d\n",c-c1);
   return 0;
}
    
asked by anonymous 07.03.2018 / 15:08

0 answers