[ABC263A] Full House

Problem Statement

We have five cards with integers $A$, $B$, $C$, $D$, and $E$ written on them, one on each card.

This set of five cards is called a Full house if and only if the following condition is satisfied:

  • the set has three cards with a same number written on them, and two cards with another same number written on them.

Determine whether the set is a Full house.

Constraints

  • $1 \leq A,B,C,D,E\leq 13$
  • Not all of $A$, $B$, $C$, $D$, and $E$ are the same.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$ $C$ $D$ $E$

Output

If the set is a Full house, print Yes; otherwise, print No.


Sample Input 1

1 2 1 2 1

Sample Output 1

Yes

The set has three cards with $1$ written on them and two cards with $2$ written on them, so it is a Full house.


Sample Input 2

12 12 11 1 2

Sample Output 2

No

The condition is not satisfied.

把5个数排序之后,判断即可。
#include<bits/stdc++.h>
using namespace std;
int a[5];
int main()
{
	for(int i=0;i<5;i++)
		scanf("%d",a+i);
	sort(a,a+5);
	if(a[0]==a[1]&&a[1]==a[2]&&a[3]==a[4]&&a[0]!=a[4]||a[0]==a[1]&&a[1]!=a[2]&&a[2]==a[3]&&a[3]==a[4])
		printf("Yes");
	else
		printf("No");
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值