Jack and Jill were passing through jungle on there way. They encountered a monster who told they will be only be allowed to escape when they solve a puzzle for him. They did't have choice so agreed. 1 1. 1 1 1 Given N number of empty buckets, we need to minimize steps to fill required number of fruits in each bucket. Only below mentioned operations are allowed to add fruits. 1. Double the count of fruits - All buckets will double the number of fruits in single operation. 2. Increment individual bucket fruit count by1 single Opertion for each bucket
3.we cannot remove/decrease number of fruits ina abucket
write programe by satisfying the above statement
Answers
*Answer:* Jack and Jill went up the hill
To fetch a pail of water
Jack fell down and broke his crown
And Jill came tumbling after
Up Jack got, and home did trot
As fast as he could caper
He went to bed to mend his head
With vinegar and brown paper
Jack and Jill went up the hill
To fetch a pail of water
Jack fell down and broke his crown
And Jill came tumbling after
Up Jack got, and home did trot
As fast as he could caper
He went to bed to mend his head
With vinegar and brown paper
Jack and Jill went up the hill
To fetch a pail of water
Jack fell down and broke his crown
And Jill came tumbling after
Up Jack got, and home did trot
As fast as he could caper
He went to bed to mend his head
With vinegar and brown paper
Explanation:
Mark me as brainleast
The function that will help to solve the puzzle is as follows.
Given:
The number of empty buckets = N.
CONSTRAINTS:
1<=target[i]<=1000, where target[i] is the element at index "Y".
1<= i <= 1000.
To Find:
We need to minimize the steps to fill the required number of fruits in each of the N number of empty buckets using a C++ program.
Solution:
The C++ program to solve the given puzzle is given below.
In order to solve the given puzzle, we need to minimize the steps to fill the required number of fruits in each of the N number of empty buckets.
The parameters in the program are an integer array that denotes the number of fruits required in the bucket and another integer denoting the number of the buckets.
Danish computer scientist Bjarne Stroustrup developed the high-level programming language C++ as an extension of the C programming language.
Hence, the C++ program to solve the puzzle is given.
public class OddEvenInArrayExample{
public static void main(String args[]){
int a[]={1,2,5,6,3,2};
System.out.println("Odd Numbers:");
for(int i=0;i<a.length;i++){
if(a[i]%2!=0){
System.out.println(a[i]);
}
}
System.out.println("Even Numbers:");
for(int i=0;i<a.length;i++){
if(a[i]%2==0){
System.out.println(a[i]);
}
}
}
}
For further reference, refer to:
https://brainly.in/question/43382646
#SPJ3