2012 Canadian Computing Competition, Stage 1
Problem J2: Sounds fishy!
A fish-finder is a device used by anglers to find fish in a lake. If the fish-finder finds a fish, it will sound an alarm. It uses depth readings to determine whether to sound an alarm. For our purposes, the fish-finder will decide that a fish is swimming past if:
- there are four consecutive depth readings which form a strictly increasing sequence (such as 3 4 7 9) (which we call "Fish Rising"), or
- there are four consecutive depth readings which form a strictly decreasing sequence (such as 9 6 5 2) (which we call "Fish Diving"), or
- there are four consecutive depth readings which are identical (which we call "Constant Depth").
All other readings will be considered random noise or debris, which we call "No Fish."
Your task is to read a sequence of depth readings and determine if the alarm will sound.
The input will be four positive integers, representing the depth readings. each integer will be on its own line of input.
The output is one of four possibilities. If the depth readings are
increasing, then the output should be
Fish Rising. If the depth
readings are decreasing, then the output should be
If the depth readings are identical, then the output should be
Fish At Constant Depth. Otherwise, the output should be
Sample Input 1
30 10 20 20
Sample Output 1
Sample Input 2
1 10 12 13
Sample Output 2
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 29, 2012
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, TEXT, PHP, SCM, CAML, PERL, C#, C++11, PYTH3