Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int find(string s){
- int total = 1, o = 0, z = 1;
- bool flag = 1;
- for(auto i: s){
- if(i == '0'){
- flag = 0;
- int save = total;
- total = 2 * total - z;
- z += save - z;
- }
- else{
- int save = total;
- total = 2 * total - o;
- o += save - o;
- }
- }
- return total - flag;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement