Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int towers=0, f=0;
- for(int i=0; i<N-1; i++) {
- if(lns[i]!=lns[i+1]) {
- f=0;
- towers++;
- }
- if(lns[i]==lns[i+1] && f==0) {
- f=1;
- towers++;
- }
- }
- if(N%2!=0)
- towers++;
- printf("%d",towers);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement