Computer Science, asked by jaikurella, 11 days ago

Given N stones, each stone has some weight assign to it.
A box with C capacity is also given. The task is to find out,
minimum number box/boxes
which are required to put
Note: C> Arr[O] to Arrinzre Arr[i] represents the 9443116
all stones in the box.
weight of ith stone.

Answers

Answered by shilpa85475
0

with the N stones, each stone has some weight assign to it.

A box with C capacity is also given.

To find out  minimum number box/boxes which are required to put

C> Arr[O] to Arrinzre Arr[i] represents the 9443116

all stones in the box. weight of ith stone.

Explanation:

If input is in sorted order

then use this lines

int x = input;

int y = 0;

int sum;

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

sum = (i * (i+1))/2;

if(x <=sum){

y = i-1;

break;

}

}

return y;

Similar questions