B - Is your horseshoe on the other hoof?
Problem description
Valera the Horse is going to the party with friends. He has been following the fashion trends for a while, and he knows that it is very popular to wear all horseshoes of different color. Valera has got four horseshoes left from the last year, but maybe some of them have the same color. In this case he needs to go to the store and buy some few more horseshoes, not to lose face in front of his stylish comrades.
Fortunately, the store sells horseshoes of all colors under the sun and Valera has enough money to buy any four of them. However, in order to save the money, he would like to spend as little money as possible, so you need to help Valera and determine what is the minimum number of horseshoes he needs to buy to wear four horseshoes of different colors to a party.
Input
The first line contains four space-separated integers s1, s2, s3, s4 (1 ≤ s1, s2, s3, s4 ≤ 109) — the colors of horseshoes Valera has.
Consider all possible colors indexed with integers.
Output
Print a single integer — the minimum number of horseshoes Valera needs to buy.
Examples
Input
1 7 3 3
Output
1
Input
7 7 7 7
Output
3
解题思路:题目的意思就是将相同的数替换掉多少个数后才能使4个数都不相同,求替换掉的个数,set容器水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int s;set<int> se;
for(int i=;i<=;++i){cin>>s;se.insert(s);}
cout<<-se.size()<<endl;
return ;
}
B - Is your horseshoe on the other hoof?的更多相关文章
- Codeforces Round #141 (Div. 2)
A. Is your horseshoe on the other hoof? 模拟题意. B. Two Tables 暴力枚举\(x,y\). C. Fractal Detector 显然,判断图形 ...
- [BZOJ4760][Usaco2017 Jan]Hoof, Paper, Scissors dp
4760: [Usaco2017 Jan]Hoof, Paper, Scissors Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 136 Solv ...
- 洛谷 P3609 [USACO17JAN]Hoof, Paper, Scissor蹄子剪刀…
P3609 [USACO17JAN]Hoof, Paper, Scissor蹄子剪刀… 题目背景 欢迎提供翻译,请直接在讨论区发帖,感谢你的贡献. 题目描述 You have probably hea ...
- bzoj4760[USACO2017 Jan]Hoof,Paper,Scissors
题意:玩n次剪刀石头布,对方每次出什么已经知道了.你出的招数必须是连续的几段(不能超过k+1段),问你最多赢几次.(n<=100000,k<=20) 正常做法:f[i][j][k]表示前i ...
- Hoof, Paper, Scissors(USACO)
题目大意: 一种游戏(类似于石头剪刀布):两个人分别给出一个字母,然后比较:H>S,S>P,P>H,我们已知对手的字母顺序,求在前n局中我们最多能赢多少次. 由于出字母的人非常懒,所 ...
- 【luogu P3609 [USACO17JAN]Hoof, Paper, Scissor蹄子剪刀布】 题解
题目链接:https://www.luogu.org/problemnew/show/P3609 ### 看着标签什么记搜什么暴力点进来,读完题第一直觉DP? 还真是个\(DP\). 题目所描述的状态 ...
- 洛谷P3906 Hoof Paper, Scissor (记忆化搜索)
这道题问的是石头剪刀布的的出题问题 首先不难看出这是个dp题 其次这道题的状态也很好确定,之前输赢与之后无关,确定三个状态:当前位置,当前手势,当前剩余次数,所以对于剪刀,要么出石头+1分用一次机会, ...
- {ICIP2014}{收录论文列表}
This article come from HEREARS-L1: Learning Tuesday 10:30–12:30; Oral Session; Room: Leonard de Vinc ...
- PHP正确的使用复数
<?php // 正确地显示复数 if(!function_exists('_plurals_format')) { /** * 正确的使用复数 * @access public * @auth ...
随机推荐
- 常见的CPU指令集介绍
本文摘自网络 一.X86 是微处理器执行的计算机语言指令集,指一个intel通用计算机系列的标准编号缩写,也标识一套通用的计算机指令集合,属于CISC. 1.1.简介 X86指令集是美国Intel ...
- vue命令行创建运行工程
// install vue-cli 安装依赖包 npm install --g vue-cli// 使用vue-cli初始化项目 vue init webpack my-project// inst ...
- php第十四节课
投票 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...
- Perl Connect to Database without password as sysdba
#!/oracle/product/11g/db/perl/bin/perl use lib '/oracle/product/11g/db/perl/lib/site_perl/5.10.0'; u ...
- Vector 和 Array 区别
1:array 定义的时候必须定义数组的元素个数;而vector 不需要:且只能包含整型字面值常量,枚举常量或者用常量表达式初始化的整型const对象, 非const变量以及需要到运行阶段才知道其值的 ...
- Scrapy下载器中间件用法示例
1.爬虫文件httpbin.py # -*- coding: utf-8 -*- import scrapy class HttpbinSpider(scrapy.Spider): name = 'h ...
- 渗透实战(周二):FLUXION暴力破解WIFI登录口令
Wi-Fi攻与防 假设我们Kali Linux 攻击机有一个无线网卡,想通过特殊手段连入名称:414的Wi-Fi网络,那以下便是特殊手段的具体过程. Wi-Fi的破解 硬件:MacBook Pro.小 ...
- 学习C语言偶遇【斐波那契数列】
1.今天学着学着就发现一个特别有趣的数列,斐波那契数列,感觉很好玩,翠花,上代码~~~~~~~ #include <stdio.h> int fibonaci(int i) { ) { ; ...
- 【BestCoder Round #93 1001】MG loves gold
[题目链接]:http://acm.hdu.edu.cn/showproblem.php?pid=6019 [题意] 每次选择一段连续的段,使得这一段里面没有重复的元素; 问你最少选多少次; [题解] ...
- 清北学堂模拟赛d5t5 exLCS
分析:比较巧妙的一道题.经典的LCS算法复杂度是O(nm)的,理论上没有比这个复杂度更低的算法,除非题目有一些限制.这道题中两个字符串的长度不一样,f[i][j]如果表示第一个串前i个,第二个串前j个 ...