Submit | All submissions | Best solutions | Back to list |
HAREFOX - Hares and Foxes |
The Antique Comedians of Malidinesia play an interesting comedy where many animals occur. Because they want their plays to be as true as possible, a specialist studies the behaviour of various animals. Recently, he is interested in a binary dynamic ecological system hares-foxes (SHF). As a part of this project, you are asked to design and implement intelligent automatic target evaluation simulator (IATES) for this system. The behaviour of the SHF follows so called standard model, described by the following set of difference equations.
hy+1 = a.hy - b.fy
fy+1 = c.fy + d.hy
where hy resp. fy represent the difference of the number of hares resp. foxes in year y and the reference count determined at the beginning of the experiment. The units of hy and fy are unknown. Therefore, hy and fy are to be treated as real numbers. Your task is to write a program to determine the long term evolution of SHF.
Input
The input consists of N cases (equal to about 5000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of six real numbers a, b, c, d, h1998 and f1998, written in this order on three lines, two numbers per line, separated by one or more spaces. The numbers are given in the classical format, i.e. optional sign, sequence of digits, optional dot and optional sequence of digits. The text form of a number does not exceed 10 characters. Each case is followed by one empty line.
Output
For each case, print one of the following sentences:
- 'Ecological balance will develop.' - if after sufficiently long time the population of both hares and foxes approaches the reference count with an arbitrary a priori given precision, i.e. lim hy=0 and lim fy=0.
- 'Hares will die out while foxes will overgrow.' - if after sufficiently long time the population of hares resp. foxes falls under resp. exceeds any a priori given threshold, i.e. lim hy=-infinity and lim fy=+infinity.
- 'Hares will overgrow while foxes will die out.' - if after sufficiently long time the population of foxes resp. hares falls under resp. exceeds any a priori given threshold, i.e. lim hy=+infinity and lim fy=-infinity.
- 'Both hares and foxes will die out.' - if after sufficiently long time the population of both hares and foxes falls under any a priori given threshold, i.e. lim hy=-infinity and lim fy=-infinity.
- 'Both hares and foxes will overgrow.' - if after sufficiently long time the population of both hares and foxes exceeds any a priori given threshold, i.e. lim hy=+infinity and lim fy=+infinity.
- 'Chaos will develop.' - if none of the above mentioned description fits.
Example
Sample input: 2 2 0.5 0.5 0.6 2 3 0.1 1 2 0.1 1 1 Sample output: Both hares and foxes will overgrow. Hares will die out while foxes will overgrow.
Added by: | adrian |
Date: | 2004-06-06 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | ACM Central European Programming Contest, Prague 1998 |
hide comments
2016-06-08 20:53:06
Reading three lines, each with two numbers, didn't work for all testcases. I got runtime error NZEC. What worked, was to read lines until six variables, separated by any number of blanks, were found. |
|
2011-02-16 03:40:23 Andrew Cooper
Can you give me clue as to why submission 4691851 gives an NZEC error? It runs fine, and give the right answer, on ideone.com with the sample input from the problem. I've found that if I wrap the lines in main which set h and f in a try block then I don't get the NZEC, but I do get wrong answer (obviously). |
|
2010-11-18 23:00:16 Hagen von Eitzen
EDIT: Never mind my misreading the unusual way of specifiýing a matrix. Last edit: 2010-11-19 17:24:22 |
|
2010-10-06 06:08:12 Riley
Are the full stops in the equation decimal points, or multipliers? |
|
2010-03-31 09:21:18 Prakash
do we need to include new line after each sentence in o/p (even last line )?? |