LINK ------->>>> https://www.codechef.com/AABH2020/problems/CRICBZ

THANKS IN ADVANCE

Its a very simple problem just think really as a cricket math and analyze my code snippet.

cin>>p>>m>>n;

if(n>=p-1)

{

// then p balls will be bowled

k=(p-1)/m;

if(k<0)

k=0;

if(2+k*m<=p)
cout<<2+k*m<<endl;

else

{

cout<<2+k

*m-m<<endl;*

}

}

else

{

r=n+2;

if(n%m==0)

{

k=(n-1)/m;

if(k<0)

k=0;

if(2+km<=p)

}

}

else

{

r=n+2;

if(n%m==0)

{

k=(n-1)/m;

if(k<0)

k=0;

if(2+k

cout<<2+k

*m<<endl;*

else

{

cout<<2+km-m<<endl;

else

{

cout<<2+k

}

}

else

{

cout<<r<<endl;

}

}

thank you for help