Is your horseshoe on the other hoof?

本文描述了一个关于马蹄颜色搭配的趣味算法问题。主角Valera有一匹马,它需要为参加聚会准备四只不同颜色的马蹄。文章通过输入四个整数来表示已有马蹄的颜色,并计算为了达到目标最少还需要购买多少只马蹄。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Is your horseshoe on the other hoof?
Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u

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.

Sample Input

Input
1 7 3 3
Output
1
Input
7 7 7 7
Output
3

Sample Output

1024
1024
0
792
Note

In the second sample, if Alice doesn't pick any mushrooms from the 5-th mountain. She can give (512+512+0)=1024 grams of mushrooms to Sunny, Lunar and Star. Marisa won't steal any mushrooms from her as she has exactly 1 kilograms of mushrooms in total.

In the third sample, there are no three bags whose total weight is of integral kilograms. So Alice must leave all the five bags and enter the forest with no mushrooms.

In the last sample:

  • Giving Sunny, Lunar and Star: (208+308+508)=1024
  • Stolen by Marisa: ((708+1108)-1024)=792

Hint


题意:给出四个数、输出重复数的个数


#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int num[4];
    while(scanf("%d",&num[0])!=EOF)
    {
        int i,res=0;
        for(i=1;i<4;i++)
         scanf("%d",&num[i]);
        sort(num,num+4);
        for(i=0;i<3;i++)
         if(num[i]==num[i+1])
          res++;
        printf("%d\n",res);
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值