spoj PEBBLE – Pebble Solver

you can get the problem statement from here.

after analysing the question a bit, we can come to the conclusion that 1’s in the bit string need odd toggles and 0’s in the bit string need even toggles. and also that we can safely strip the prefixed zero’s.

because if you try to toggle any of them you need to toggle some other-thing preceding that zero(which is also zero), so you don’t want to toggle the prefixed zero’s. based on these conclusions you can easily solve the problem..

https://gist.github.com/071aca1636248cb0e13c

Advertisements

One thought on “spoj PEBBLE – Pebble Solver

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s