VPL2_AA - Luis Quest

no tags 

Luis is playing his old metroid game. Just a little while ago he pass trough a scenario where the room was filled with some amoeba-like creatures. The room started with some initial number of creatures, but they multiply their selves very quickly, because their growth rate is proportional to the number of creatures at a certain time. Luis took note about this fact, he wrote the number of creatures at the initial time, and then, after wait t time units, he wrote the new amount. Now Luis wants to know, for a certain number of creatures p, the exact time he has to be in the room to see that amount.

Input

The first line contains an integer T, which specifies the number of test cases. Then, will follow the descriptions of T test cases.

For each test case, there will be 2 lines, the first one will contain 4 integers, p0, p1, t and p. These numbers represents the initial amount of creatures, the second amount of creatures, the time units that Luis waited to see that change, and the number of creatures that Luis wants to see.

Output

For each input case you must print a single line containing the string "Scenario #i: " where i is the number of the test case (starting at one), and then the answer to the problem rounded to two decimal places. There will always be an answer.

Example

Input:
4
10 15 3 15
10 15 3 20
5 12 2 50
5 12 2 7

Output:
Scenario #1: 3.00
Scenario #2: 5.13
Scenario #3: 5.26
Scenario #4: 0.77

Constraints - 100%

1 ≤ T, p0, p1, t, p ≤ 100


hide comments
dynamo214: 2018-08-12 13:55:38

Easy Peasy.Just remember formula for exponential increment of insects - N = No * e^rate*time

sharif ullah: 2016-08-10 08:38:37

Just use physics formula N=No e^-lemda*t

mkfeuhrer: 2016-06-21 18:42:46

WA in c++ .... AC in c!!

piotrwie: 2016-02-05 14:07:04

A typical "Project Manager" problem ;)
9 women will not produce 1 child in 1 month :)
If it takes 3 seconds for amoeba to split, even after 2,99 seconds you'll have still only 10 amoebas in your room. And in 3,01 second you'll suddenly have 20 of them.

pranay: 2015-09-01 20:19:05

use first order equilibrium rate equation

shravinson: 2015-08-23 10:11:11

got 1 WA because of output pattern...
my 1st century

Last edit: 2015-08-23 10:11:40
anuveshkothari: 2015-07-28 14:12:13

solution of the problem is depends completely on this line
their growth rate is proportional to the number of creatures at a certain time.

scyth3r: 2015-07-12 23:05:18

INPUT:
4
10 15 3 15
10 15 3 20
5 12 2 50
5 12 2 7
OUTPUT:
Scenario #1: 3.00
Scenario #2: 5.13
Scenario #3: 5.26
Scenario #4: 0.77
There exists no blank line in input and output.
Got 2 NZEC bcoz of that

viju11: 2015-06-03 21:05:01

there is a space b/w Scenario & # and b/w ":" and answer. costed me many wrong answers -_-

Rishabh Joshi: 2015-05-26 21:39:06

Keep getting NZEC in C#.
AC in C.
-_-

Last edit: 2015-05-26 21:46:10

Added by:Venezuelan Programming League
Date:2013-06-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64