We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Extremely Dangerous Virus
Extremely Dangerous Virus
Sort by
recency
|
10 Discussions
|
Please Login in order to post a comment
An extremely dangerous virus can lead to panic, confusion, and even accidents due to impaired focus or emergency situations. In cases where a crash occurs during such times, having a car accident attorney can help victims navigate legal claims and get proper compensation — especially when health and legal risks overlap.
Python 3 solution for cases where a+b is even (all test cases):
static int solve(int a, int b, long t) {
`
GIven probability is 0.5 ( 1/2 ) . Factors are a and b . Initially cell is 1
Every time ,it grows according expected value using factor given a & b
fIrst time virus cell will be (a*(1/2)) + (b*(1/2)) = (a+b)/2;
Now cells are (a+b)/2; Now this will be growing into again by factor a & b with probability (1/2) .Let's see ....................
a*( ( a + b ) / 2 ) * ( 1 / 2 ) + b* ( ( a + b ) / 2 ) * ( 1 / 2 )
= ( ( a + b ) / 2 ) * (( a + b ) / 2 ) ) , when time is 2 milisecond .
So from this pattern , we can say ( ( a + b ) / 2 ) ^ t ....... %mod .
` My code
Initially there is a single virus who replicates into (a+b)/2 expected number of viruses at time=1 ms. These (a+b)/2 new viruses further replicate into (a+b)/2 new viruses each at time=2 ms.
Let us call (a+b)/2 as mean.
Total number of viruses at time=2ms:
=mean*mean
=mean^2
After time=t ms, mean^t;
A simple pow(mean,t) should work if value of t is small. However, in this case, we need to use fast exponentiation.