[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");
}
随机推荐
- PyAV 使用浅谈
背景: PyAV是一个用于音频和视频处理的Python库,它提供了一个简单而强大的接口,用于解码.编码.处理和分析各种音频和视频格式.PyAV基于FFmpeg多媒体框架,它本质上是FFmpeg 的Py ...
- Solidity-变量和数据类型[基本类型]
在solidity语言中,变量和数据类型分为三类:基本类型(bool.int.address等),复合类型(array.struct.mapping等)和特殊类型(enum.function.modi ...
- 如何正确实现一个自定义Exception(二)
上一篇<如何正确实现一个自定义 Exception>发布后获得不少 star.有同学表示很担忧,原来自己这么多年一直写错了.其实大家不用过分纠结,如果写的是 .NET CORE 1.0+ ...
- 解锁Java面试中的锁:深入了解不同类型的锁和它们的用途
简介 多线程编程在现代软件开发中扮演着至关重要的角色.它使我们能够有效地利用多核处理器和提高应用程序的性能.然而,多线程编程也伴随着一系列挑战,其中最重要的之一就是处理共享资源的线程安全性.在这个领域 ...
- 3DMatch
详细描述链接:3DMatch 数据集.github(介绍非常详细) 官网主页: 主页 3DMatch数据集收集了来自于62个场景的数据,其中54个场景的数据用于训练,8个场景的数据用于评估,其具体名称 ...
- vscode没有完全汉化怎么办? vs code部分内容没汉化的解决办法
- commons中StringUtils的全解
StringUtils()方法的导入包是:org.apache.commons.lang3.StringUtils 作用是:StringUtils()方法是 Apache Commons Lang 库 ...
- 2020/5/8—cf,我裂开来
呜呜呜我爆零了呜呜呜ljll 嗯T1T2防爆零的没了呜呜呜在此纪念可怜的yjz大佬21发AC 太惨了(逃 先来说说我们都有些啥题目吧... T1 嗯,裂开了,当场裂开我一看!桶排!然后实现,嗯?嗯!嗯 ...
- 手把手教你在项目中引入Excel报表组件
摘要:本文由葡萄城技术团队原创并首发.转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 前言 GrapeCity Documents for Excel(以下 ...
- #866 div1A
A. Constructive Problem 题意:给定一个长度为n的非负数组a,我们可以进行一次操作,操作是将l~r这个区间内的所有数变为k(k >= 0),得到b,能不能使mex(a)+ ...