why my output is not coming as desired.Is my cancook function wrong .Please check it and tell the error in cancook function.
INPUT
1
10
4 1 2 3 4
OUTPUT : 12
Regarding roti prata problem of spoj
@D19APPPP0016
refer to this
bool isPossible(int p,int cook[],int n,int mid){
int cnt = 0; for(int i=0;i<n;i++){ //for each cook count the pratas int c = 0;// int time = mid; int perpratas = cook[i]; // time taken to cook each pratas by ith cook while(time > 0){ time = time - perpratas; if( time >= 0){ c += 1; perpratas += cook[i]; } } cnt += c; if(cnt >= p) return true; } return false;}