Doubt in my code

Hello, I have almost write the code of this prata problem but I am stucked at isPossible( ) function implementation.

Help !!!

Hey @yashsharma4304

bool isPossible(int p, int l, int r[], int curr_min){

   int  silver=0 ; //total pratas count

   for (int i = 0; i < l; i++) {

       int x = 1;  

       while ( (x * (x + 1)*r[i]) <= 2*curr_min )  //Here pratas are made in arr[i] ,2arr[i] ,3arr[i] .... summation = x*(x+1)/2*arr[i] so we are doing that here to find max x which satisfy that

           x++;

       x--;

       silver += x ; //adding pratas by current chef to total answer

   }

   return silver>=p ;  //if total pratas > required pratas 

}
1 Like

Ok thanks for your help. Is my implementation correct or will there be any problems with it ?

Because for now it worked well

By the way what is x here ?

How many prantas this particular chef will make