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 ;
}
最新文章
- ASP.Net Core 里是如何把一个普通的 Action 返回类型转换为某种 IActionResult 的
- 面向对象和面向过程的jquery版选项卡
- HDU 2291
- jquery基础教程读书总结
- IE6下Png透明最佳解决方案(推荐) Unit PNG Fix
- iOS内存管理(一)
- .net 文件下载方法
- mvn打包发布
- c#中命令copy已退出,返回值为1
- Yii2.0 解决“the requested URL was not found on this server”问题
- C#获取日期的星期名称
- python 的基础 学习 第三
- 利用ASP.NET运行数据库的安装脚本
- PL/SQL Developer的安装以及与64位Oracle Database进行连接
- Autotools使用流程【转】
- 【DC010沙龙年度合集】顶尖Hacking技术盛宴(文末福利)
- Oracle 默认的driectory 目录
- Python面向过程和面向对象基础
- HDU1232 畅通工程,并查集
- jvm基础(2)
热门文章
- PAT_A1114#Family Property
- thinkphp里模版文件js无法使用if condition的问题
- 1.Linux入门介绍
- Django 初学
- Cookie的Python爬虫应用
- Selenium的安装和简单实用——PhantomJS安装
- poj 1860 bellman 求正环
- [bzoj3450]Tyvj1952 Easy[概率dp]
- BZOJ——T 4563: [Haoi2016]放棋子
- [转]十五天精通WCF——第八天 对“绑定”的最后一点理解