time limit per test: 1 second
memory limit per test: 256 megabytes
Amadoo and Lashin, brilliant students in Math Problem Solving, have the ability
to solve many of problems challenge. They always compete with each other to
solve the most difficult challenges. One day Lashin challenge Amadoo to solve a
problem challenge that include:
"Let the initial population of a city be $(N_0)$ millions. If $N(t)$ is the number of
inhabitants in millions and $t$ is the time in years. Determine the differential
equation considering that the rate at which the population of this city is growing
per year, is proportional to the product of its population and the difference of its
population from $L$ millions. Consider that the proportionality constant is $A$.Find
the long term prospects of this population, as predicted by this model, after $t$
years and after very long time $(t \rightarrow \infty)$". You must Help Amadoo to solve this
problem.
Input
The first line contains $m(1 \le m \le 10^3)$, the number of the testcases.
The first line of each test case contains $N_0$, $A$, $L$ $(1 \le N_0, A, L \le 10)$, the
initial population, proportionality constant, and maximum capacity.
The second line of each test case contains a decimal number $t$ $(0 \le t \le 1)$.
Output
The first line is a single integer: $lim_{t \rightarrow \infty} N(t)$, the long-term population in
millions.
The second line consists of $N(t)$, the population at the given times in millions,
rounded to the nearest integer.
Example
input
1
2 2 8
0.190283
output
8
7
Copy
Copy