[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");
}
随机推荐
- C语言下载minGW地址
https://sourceforge.net/projects/mingw-w64/files/ 下载红框内即可
- 零代码,使用 Dify 和 Laf 两分钟接入企业微信 AI 机器人
Dify 允许创建 AI 应用,并提供二次开发的能力.这里我将演示创建一个法律问答助手的 AI 应用,称作"知法".在本篇教程中,我将指导你为"知法"接入企业微 ...
- DesignPattern-part1
title: "modern C++ DesignPattern-Part1" date: 2018-04-03T16:06:33+08:00 lastmod: 2018-04-0 ...
- C#开发的基础工具类集合 - 开源研究系列文章
今天发布一个基础工具类代码集合. 以前有发布过一个类似的类库(见博文: Magical平台类库代码分享 ),不过那个版本有点久了,也没有这次这个全面,这次发布的是一个很多地方用到的基础类库代码. 1. ...
- 升讯威在线客服系统的并发高性能数据处理技术:PLINQ并行查询技术
我在业余时间开发维护了一款免费开源的升讯威在线客服系统,也收获了许多用户.对我来说,只要能获得用户的认可,就是我最大的动力. 最近客服系统成功经受住了客户现场组织的压力测试,获得了客户的认可. 客户组 ...
- Go之流程控制大全: 细节、示例与最佳实践
本文深入探讨Go语言中的流程控制语法,包括基本的if-else条件分支.for循环.switch-case多条件分支,以及与特定数据类型相关的流程控制,如for-range循环和type-switch ...
- 使用MySQL存储过程提高数据库效率和可维护性
MySQL 存储过程是一种强大的数据库功能,它允许你在数据库中存储和执行一组SQL语句,类似于编程中的函数.存储过程可以大幅提高数据库的性能.安全性和可维护性.本文将详细介绍MySQL存储过程的使用. ...
- Microsoft Build 2021大会开始后,Develop Blog一系列更新
.NET BLOG 发布.NET 6预览版4 https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-4/ 发布.NET MAUI ...
- EQ 均衡器
EQ 的全称是 Equalizer,EQ 是 Equalizer 的前两个字母,中文名字叫做"均衡器".最早是用来提升电话信号在长距离的传输中损失的高频,由此得到一个各频带相对平衡 ...
- Semantic Kernel .NET SDK 的 v1.0.0 Beta1 发布
介绍 Semantic Kernel (SK) 是一个开源的将大型语言模型(LLM)与流行的编程语言相结合的SDK,Microsoft将Semantic Kernel(简称SK)称为轻量级SDK,结合 ...