noob_is_my_name's blog

By noob_is_my_name, history, 5 years ago, In English

Problem link :- https://mirror.codeforces.com/gym/102948/problem/F

I am new to problem solving and was solving this problem, kindly help me with this :- My approach :- we can reach any lily pad which can be expressed in the form of x*N — y*M, x>= 0 && y>=0. So, I am using two loops to do so :-

for(ll i = 0; i<= l; i+= n) {

for(ll j = 0; (i + j) > 0 ;j-= m) {
       if(mp[i + j] == 1){
           mp[i + j] = 0;
           c++;
       }
   }

}

But, it is giving WA, since there was no editorial and I was unable to see other users submission, hence I am writing this blog.

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it