25. It takes five minutes to pass a rumour from one
person to two other persons. The tree of rumour continues.
Find how many minutes does it take spread the rumour to 768
persons. ?
Answers were Sorted based on User's Feedback
Answer / pradeep
Yes Bindu, You are right and thanks for correcting me.
and the right answer is 35 minutes.
Please find the logic and the program below:
int ppl , time , i , sum = 0;
printf("Enter the number of ppl u want to spread \r\n");
scanf("%d",&ppl);
while(sum<ppl)
{
sum = pow(3,i);
time = 5 * i;
i++;
}
printf("time in min required is %d \r\n",time);
[
out put:
Enter the number of ppl u want to spread
768
time in min required is 35
]
==================
For your refernce :
1->2 [ total 3 ppl ] took 5 min;
3 -> 6 [ total 9 ppl ] took 10 min
9 ->18 [ total 27 ppl ] took 15 min ..
27 -> 54 [ total 81 ppl ] took 20 min
81 -> 162 [ total 243 ppl ] took 25 min
243 -> 486 [ total 729 ppl ] took 30 min
729 -> 1458 [ total 2187 ppl ] took 35 min
overall it's power of 3
============================
Is This Answer Correct ? | 19 Yes | 3 No |
Answer / manish panwar
// It's a combination of 1+2+4+8+16+.... and each intervl
takes 5 minutes.
SO
1+2+4+8+16+32+64+128+256+512+1024
11*5 = 55 MINTS IN TOTAL .
Is This Answer Correct ? | 11 Yes | 5 No |
Answer / bindu
In the first 5 mins three people come to know of the
rumour; including the first person (who is still able to
spread the rumour!), i..e every 5 mins, three times the
people come to know of the rumour. So it just takes 30 mins
for 729 people and 35 mins for 2187 people to know of the
rumour.
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / bindu
But Pradeep, your logic assumes that the people who have
already passed the rumour in the first 5mins, will not pass
it again in the next 5mins!! In my logic, they keep on
passing it; 1.e. they don't stop after the first time.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / usha
Its 45 min becoz the Ist person spreeds rumour to 2person in
5 min. so in next 5 min the 2 person spreads simultaneously
to 4pesons and these steped is continued tel 45min, such as
2+4+8+16+32+64+128+256+512 this indicate at each addition it
take 5min. so the answer is 45min
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / pradeep
It requires 45 minutes:
Find the logic below:
int time;
for ( int i=0,SpreadRate=1,Ppl=0;Ppl<=768;i++)
{
Ppl = Ppl + SpreadRate;
time = 5 * i;
SpreadRate = SpreadRate * 2;
}
printf("time in min %d \r\n"),time);
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / pradeep
// It's a combination of 1+2+4+8+16+.... and each intervl
takes 5 minutes.
so use the below logic to find out the ryt answer
int time;
for ( int i=0,sum=0;sum<=768;i++)
{
sum = sum+(2*i);
time = 5*i;
}
printf("time in min %d \r\n"),time);
correct answer is 140 minutes [ nothng but 2 hours 20 min]
return TRUE;
Is This Answer Correct ? | 4 Yes | 12 No |
What is period operator in c?
A set of N billiard balls are set on a one-dimensional table. The table is 1 meter long, set north-south with two pockets at either side. Each ball has zero width and there is no friction so it is moving with a fixed velocity of either northward or southward and bounces back in a perfect elastic collision from other balls it encounter on its way (or drop into one of the pockets). Your job is to keep track of the balls movements. Task Please write a program that gets the initial place, speed and direction of all the balls and gives the position of a specific ball after t seconds. Input The first line contains the number of scenarios. Each one of the other lines in the input contains a scenario: The first number, N, is the number of balls; followed by N pairs of numbers: the distance in centimeters from the south end of the table and the speed (positive speed meaning it moves northward); the last two numbers are the number i of the target ball you should track and the time T in seconds. Output The output is a single number for each line which is the place (distance in centimeters from the south end of the table) of the tracked ball after T seconds. Note: There is no new line character at the end of the result. Sample Input 5 1 50 1 1 1000 1 50 1 1 6 1 60 -2 1 6 2 10 1 95 -1 2 30 2 10 1 95 -1 2 60 Sample Output 100 56 48 65 70
What does the characters “r” and “w” mean when writing programs that will make use of files?
how to make a scientific calculater ?
What is queue in c?
How can I access an I o board directly?
main() { int i; printf("%d",i^i); }
What is a static variable in c?
convert 12345 to 54321 withoutusing strig
What does 1f stand for?
How do you sort filenames in a directory?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none