[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");
}
随机推荐
- ETL之apache hop系列1-ETL概念与hop简介
ETL 简单介绍 ETL概念 ETL,是英文Extract-Transform-Load的缩写,用来描述将数据从来源端经过抽取(extract).转换(transform).加载(load)至目的端的 ...
- springboot集成seata1.5.2+nacos2.1.1
一.前言 Seata出现前,大部分公司使用的都是TCC或者MQ(RocketMq)等来解决分布式事务的问题,TCC代码编写复杂,每个业务均需要实现三个入口,侵入性强,RocketMQ保证的是最终一致性 ...
- 正则表达式快速入门二 :python re module 常用API介绍
python regex module re 使用 reference regex module in python import re re.search re.search(regex, subj ...
- Spring Event 观察者模式, 业务解耦神器
观察者模式在实际开发过程中是非常常见的一种设计模式. Spring Event的原理就是观察者模式,只不过有Spring的加持,让我们更加方便的使用这一设计模式. 一.什么是观察者模式 概念: 观察者 ...
- Solution -「洛谷 P5610」「YunoOI 2013」大学
Description Link. 区间查 \(x\) 的倍数并除掉,区间查和. Solution 平衡树. 首先有个基本的想法就是按 \(a_{i}\) 开平衡树,即对于每个 \(a_{i}\) 都 ...
- 西门子Teamcenter 许可分析
西门子Teamcenter 许可 绑定了主机名称,mac地址 另外,Teamcenter可以支持多个许可服务 所以.......................找个正式许可复制就可以 end succ ...
- 2023-09-23:用go语言,假设每一次获得随机数的时候,这个数字大于100的概率是P。 尝试N次,其中大于100的次数在A次~B次之间的概率是多少? 0 < P < 1, P是double类型,
2023-09-23:用go语言,假设每一次获得随机数的时候,这个数字大于100的概率是P. 尝试N次,其中大于100的次数在A次~B次之间的概率是多少? 0 < P < 1, P是dou ...
- 谱图论:Laplacian二次型和Markov转移算子
以下部分是我学习CMU 15-751: TCS Toolkit的课堂笔记.由于只是个人笔记,因此许多地方在推导上可能不那么严谨,还望理论大佬多多包涵. 1 问题定义 1.1 无向图\(G\) 在本文中 ...
- oracle优化-分页查询新认识
在写这篇文章之前,对分页查询的认识就是经典的三层嵌套:第①层:获得需要的数据,第②层:用rownum限制展示数据的上限,第③层:用rownum的别名rn限制展示数据的下限. 在生产中遇见一个两层嵌套满 ...
- 用现代C++写一个python的简易型list
std::variant介绍:en.cppreference.com/w/cpp/utility/variant 通过泛型模板(仅提供了int, double, string三种类型的存储),实现了a ...