Advertisement
ismail5g

Codeforces Div-2-484

May 17th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4.  
  5. int main()
  6. {
  7.     int i, n, c=0, len;
  8.     char chair[1005];
  9.     scanf("%d", &n);
  10.     scanf("%s", chair);
  11.     len=strlen(chair);
  12.     for(i=0; i<len; i++){
  13.         if(chair[i]=='1'){
  14.             c++;
  15.         }
  16.         else{
  17.             c--;
  18.         }
  19.     }
  20.     if(c==1 || c==0)
  21.         printf("Yes\n");
  22.     else
  23.         printf("No\n");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement