1 class Solution 2 { 3 public: 4 vectorprefixesDivBy5(vector & A) 5 { 6 vector v(A.size()); 7 int rnt = 0; 8 for(int i = 0; i< A.size();i ++) 9 {10 if(A[i]==1)11 {12 if(rnt==0)13 {rnt = 1;v[i] = false;}14 else if(rnt==1)15 {rnt = 3;v[i] = false;}16 else if(rnt==2)17 {rnt = 0;v[i] = true;}18 else if(rnt==3)19 {rnt = 2;v[i] = false;}20 else if(rnt==4)21 {rnt = 4;v[i] = false;}22 }23 else if(A[i]==0)24 {25 if(rnt==0)26 {rnt = 0;v[i] = true;}27 else if(rnt==1)28 {rnt = 2;v[i] = false;}29 else if(rnt==2)30 {rnt = 4;v[i] = false;}31 else if(rnt==3)32 {rnt = 1;v[i] = false;}33 else if(rnt==4)34 {rnt = 3;v[i] = false;}35 }36 }37 return v;38 }39 };