Getting WA verdict

Problem Link:

My Solution:

Can you plz figure out what I am doing wrong? Problem seems to be very straight forward.

Hey @tasfikrahman007

    while(str < y)
    {
        if(str * a < str + b )
        {
            str = a * str;
            if (str < y)
                exp++;
            else {
                str=str/a; //added this
                break;
            }
        }
        else
        {
            break;
        }
    }

Now it will give u 1 TLE for that avoid if else and directly do with while loop conditions

Still getting 1 TLE with this approach: https://ide.codingblocks.com/s/358366

Hey @tasfikrahman007

while (str < (y/a) && (str * a < str + b))
Change it like this because a*str can overflow

Thank you so much bro, it got AC :slight_smile:

1 Like