|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||5||5||5||100.000%|
Hobbits like games of chance and skill. As such they play a game very much like our poker, though their decks of cards and rules are a bit different.
A deck of cards therefore has 105 cards. Each “hand” has 5 cards, just like poker.
Your task is to write a program to identify two types of hands: a “spread” and a “rainbow”.
The rules for a “spread” are as follows: the suits don’t matter but the values do. The values must be such that the difference between any two card values is not the same as the difference between any other two card values.
For example, a hand with containing cards with values 1, 2, 4, 8, 16 is a spread because any pair of values has a unique difference:
|First Card||Second Card||difference|
The rule for a “rainbow” is simply that the hand must have exactly one card of each suit.
The first line in the test data file contains the number of test cases (< 100). After that each line will contain a test case, with each card being represented by two integers (thus each test case comprises of 10 integers). The first number is the card’s suit (an int that takes values between 0 and 4, inclusive), and the second represents the card’s suit (an int that takes values between 1 and 21, inclusive).
For each test case, the program needs to indicate whether or not that hand of cards has a spread and whether or not that hand of cards has a rainbow. The exact format is shown below.
2 0 1 0 2 0 4 0 8 0 16 0 1 1 1 2 1 3 1 4 1
Have a spread. Do not have a rainbow. Do not have a spread. Have a rainbow.