P3087 [USACO13NOV] Farmer John has no Large Brown Cow S
Description
Farmer John likes to collect as many different types of cows as possible. In fact, he has collected almost every possible type of cow, except for a few, written on a short list of N lines (1
Input Format
* Line 1: Two integers, N and K.
* Lines 2..1+N: Each line is a sentence like "Farmer John has no large spotted noisy cow.". Each adjective in the sentence is a string of at most 10 lowercase letters. You know you have reached the end of the sentence when you see the string "cow." ending with a period.
Output Format
* Line 1: The description of the K-th cow on the farm.
Explanation/Hint
The input matches the sample given in the problem statement above. Farmer John would like to know the 7th cow on his farm, when listed in alphabetical order.
Farmer John has cows matching the following descriptions, listed in alphabetical order:
large brown silent
large spotted silent
large white noisy
large white silent
small brown noisy
small brown silent
small spotted noisy
small spotted silent
small white noisy
The 7th cow in this list is described as "small spotted noisy".
Translated by ChatGPT 5