Assume,total no of breads,x=48
first person stole,x/2 = 48/2 = 24.
second person stole,x/4 =(x/2)/2 = 24/12 =12.
third person stole, x/8 = (x/4)/2 = 12/2 =6.
fourth person stole, x/16 = (x/8)/2 = 6/2 =3.
Total breads stolen= 24+12+6+3 =45.
Still at the end there are 3 breads remaining what has
mentioned in the given question.
Hence no of breads initially are,48.
If we assume no of breads initially,x=63.
But in the question at the end there must be 3 breads
remaining,but in your logic 7 breads remaining,so 63 is
no of breads initially=x
breads taken by first thief= x/2+1/2=(x+1)/2
remaining breads= x-((x+1)/2)=(x-1)/2
breads taken by second theif= ((x-1)/4)+1/2=(x+1)/4
remaining breads= x-((x+1)/4)=(x-1)/4
remaining bread after third theif rob=(x-1)/8
remaining bread after forth theif rob=(x-1)/16
There are two sorted arrays
a1 and a2 of size n1 and size n2 respectively.
array a1 is full
array a2 has exactly n1(size of array a1) empty space.
a2=56789_ _ _ _
Write a function to merge these two arrays to form a sorted
array without any extra memory use.
i want a solution in c/c++ language
In a certain department store, which has four sizes of a
specific shirt, there are 1/3 as many small shirts as medium
shirts, and 1/2 as many large shirts as small shirts. If
there are as many x-large shirts as large shirts, what
percent of the shirts in the store are medium?
A starts from a place at 11.00 am and travels at a speed of
4 kmph , B starts at 1.00 pm and travels with speeds of 1
kmph for 1 hr , 2 kmph for the next hr , 3 kmph for the
next hr and so on. At wht time will B catch up with A ?
City A's population is 68000, decreasing at a rate of 80
people per year. City B having population 42000 is
increasing at a rate of 120 people per year. In how many
years both the cities will have same population?
If you take a marker & start from a corner on a cube, what
is the maximum number of edges you can trace across if you
never trace across the same edge twice, never remove the
marker from the cube, & never trace anywhere on the cube,
except for the corners & edges?