Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- int main()
- {
- int i, n, c=0, len;
- char chair[1005];
- scanf("%d", &n);
- scanf("%s", chair);
- len=strlen(chair);
- for(i=0; i<len; i++){
- if(chair[i]=='1'){
- c++;
- }
- else{
- c--;
- }
- }
- if(c==1 || c==0)
- printf("Yes\n");
- else
- printf("No\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement