mardi 4 août 2015

wrong answer on test case 1 in this code?

http://ift.tt/1SIFHF8

i tried to solve it. But my code all time results in wrong answer on test case 1. I don't understand the problem in this code.

#include <stdio.h>
int main ()
{ int n;
char a[10];
int s=0;
scanf ("%d",&n);

fflush(stdin);
for (int i=1;i<=n;i++)
{ gets(a);


    if (a[0]=='+' || a[1]=='+') s++;

   else  if (a[0]=='-' || a[1]=='-') s--;

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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire