Problem E
Where, Oh Where Has my Little Dog Gone?
Oh, where, oh where has my little dog gone?
Oh, where, oh where can he be?
With his ears so short and his tail so long,
Oh, where, oh where can he be?
You have been contracted by the local humane society to write a program that will help identify the breeds of dogs. The idea is that a novice volunteer can take measurements of a dog found missing. The volunteer would then post the probable breed and other details on social media in hopes the owner will see it and come for the missing pet.
Your program should input the length of the ears and tail of a missing dog and attempt to match it through a database that will be given to you next. The database will contain length ratios of ears to tails of various breeds along with typical ranges of ear length. If there is more than one possible match, you are to list each possible breed in the order of appearance in the database.
Input
The input will consist of two parts: the details of the lost dog followed by the database. The first line of input will contain two numbers: the length of the ears and the length of the tail of the missing dog, both in inches and accurate to two decimal places.
The first line of the following database will contain a single positive integer indicating the number of breeds in the database. The number of listed dog breeds in the United States is 200, according to the AKC. That will be sufficient for our purposes. Following this are two lines for each breed. On the first of these two lines is the name of the breed. On the second of these two lines are four numbers: the range of possible ear to tail length ratios (low and high) for that breed (both 0.1 - 1.0) followed by the range of possible ear lengths (low and high) for that breed (both 1.0 - 15.0 inches). Note that tails may range from 1 - 30 inches in length.
Output
Print any possible breeds for the lost dog, one per line in the order of appearance. If there are no matches, print the message "Mutt"
Sample Input 1 | Sample Output 1 |
---|---|
3.4 6.8 5 breedA 0.2 0.4 3.0 3.5 breedB 0.5 0.6 3.1 3.4 breedC 0.3 0.5 4.0 5.0 breedD 0.8 0.9 1.0 3.0 breedE 0.2 0.5 2.7 4.4 |
breedB breedE |
Sample Input 2 | Sample Output 2 |
---|---|
3.4 4.0 5 breedA 0.2 0.4 3.0 3.5 breedB 0.5 0.6 3.1 3.4 breedC 0.3 0.5 4.0 5.0 breedD 0.8 0.9 1.0 3.0 breedE 0.2 0.5 2.7 4.4 |
Mutt |