

実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 250 点
問題文
7 枚のカードがあります。i 番目 (i=1,\ldots,7) のカードには整数 A_i が書かれています。
これらのカードから 5 枚を選び、フルハウスとできるか判定してください。
ただし、 5 枚組のカードは以下の条件を満たすとき、またそのときに限って、フルハウスであると呼ばれます。
- 異なる整数 x,y について、 x が書かれたカード 3 枚と y が書かれたカード 2 枚からなる。
制約
- A_i は 1 以上 13 以下の整数
入力
入力は以下の形式で標準入力から与えられる。
A_1 A_2 A_3 A_4 A_5 A_6 A_7
出力
5 枚カードを選んでフルハウスとできるなら Yes
、そうでないなら No
と出力せよ。
入力例 1
1 4 1 4 2 1 3
出力例 1
Yes
例えば、 (1,1,1,4,4) とカードを選択することでフルハウスとできます。
入力例 2
11 12 13 10 13 12 11
出力例 2
No
7 枚のカードからどのように 5 枚を選んでもフルハウスとはできません。
入力例 3
7 7 7 7 7 7 7
出力例 3
No
同じカード 5 枚組はフルハウスではないことに注意してください。
入力例 4
13 13 1 1 7 4 13
出力例 4
Yes
Score : 250 points
Problem Statement
We have seven cards. The i-th card (i=1,\ldots,7) has an integer A_i written on it.
Determine whether it is possible to choose five of them so that the chosen cards form a full house.
A set of five cards is called a full house if and only if the following conditions are satisfied:
- For different integers x and y, there are three cards with x and two cards with y.
Constraints
- A_i is an integer between 1 and 13, inclusive.
Input
The input is given from Standard Input in the following format:
A_1 A_2 A_3 A_4 A_5 A_6 A_7
Output
If a full house can be formed by choosing five cards, print Yes
; otherwise, print No
.
Sample Input 1
1 4 1 4 2 1 3
Sample Output 1
Yes
For example, by choosing the cards (1,1,1,4,4), we can form a full house.
Sample Input 2
11 12 13 10 13 12 11
Sample Output 2
No
No five cards chosen from the seven cards form a full house.
Sample Input 3
7 7 7 7 7 7 7
Sample Output 3
No
Note that five identical cards do not form a full house.
Sample Input 4
13 13 1 1 7 4 13
Sample Output 4
Yes