codeforces——228A —— Is your horseshoe on the other hoof?
来源:互联网 发布:飞利浦shp8000 知乎 编辑:程序博客网 时间:2024/06/04 22:47
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.
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.
Print a single integer — the minimum number of horseshoes Valera needs to buy.
1 7 3 3
1
7 7 7 7
3我觉得没办法再水了。。统计四个数中不同的个数,用4减所得数#include<stdio.h>#include<iostream>#include<cstring>#include<cmath>#include<algorithm>#include<map>using namespace std;int main(){ int a[4]; while(~scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])) { sort(a,a+4); int ans=1; for(int i=1; i<=3; i++) if(a[i]!=a[i-1]) ans++; cout<<4-ans<<endl; } return 0;}
- codeforces——228A —— Is your horseshoe on the other hoof?
- CodeForces-228A-Is your horseshoe on the other hoof?
- CodeForces 228A Is your horseshoe on the other hoof?
- 228A - Is your horseshoe on the other hoof?
- Codeforces Is your horseshoe on the other hoof?
- Is your horseshoe on the other hoof?
- A. Is your horseshoe on the other hoof?
- codeforces228A Is your horseshoe on the other hoof?(水题)
- Your boot partition is on a disk using the GPT
- Codeforces刷题之路——266A Stones on the Table
- The shoe is on the other foot 指什么
- 411. The grass is greener on the other side. 这山望着那山高
- capacity is approximately 1880 cubic inches. On the other hand
- On the other hand
- Your boot partition is on a disk using the GPT partitioning Scheme but this machines cannot boot
- codeforces——581A——Vasya the Hipster
- codeforces—— 869A —— The Artful Expedient
- 【codeforces】601A—— The Two Routes
- 使用Nginx搭建rtmp流媒体服务器笔记
- Microsoft.Office
- link和@import的区别及联系
- springmvc如何设置多个同类型的视图器(springmvc 多个 ViewResolver)
- Spring事务之声明式事务
- codeforces——228A —— Is your horseshoe on the other hoof?
- 自适应噪声消除器
- 排序算法总结
- rhel-server-6.6-x86_64 openssh源码升级
- Kafka精确一次
- Linux驱动开发———总线设备驱动模型
- Android EventBus源码解析 带你深入理解EventBus
- python模块
- 杂文-远程过程调用协议RPC(Remote Procedure Call Protocol)