Tuesday, January 21, 2020

Codeforces 282A Bit++ Solution in C



  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int i,j,k,n,s;
  6. char x[7];
  7. scanf("%d",&n);
  8. j=0;
  9. k=0;
  10. for (i=0;i<n;i++)
  11. {
  12. scanf("%s",&x);
  13. if (x[0]=='+' || x[2]=='+')
  14. {
  15. j++;
  16. }
  17. else
  18. {
  19. k++;
  20. }
  21. }
  22. s=j-k;
  23. printf("%d\n",s);
  24. return 0;
  25. }

No comments:

Post a Comment

Codeforces 131A cAPS lOCK Solution in C

#include <stdio.h> int main () { char ch [ 106 ]; int i , j , ck = 1 ; scanf ( "%s" , ch ); ...