【解決方法】色違いの蹄鉄ですか?


Maximus horse wants to go to the party with his friends. He loves to keep up with the newest fashion trends, especially in wearing horseshoes, and now the latest fashion trends are wearing all horseshoes of different colors.

Maximus already has horseshoes, but probably some of them are the same color, so he needs to make shopping to buy the new horseshoes and to be pretty nice at the party. The horseshoe store offers many colors of horseshoes, and Maximus has enough money to buy any four of them. You need to help Maximus to determine the minimum number of horseshoes he needs to buy to wear four horseshoes of different colors to a party.

私が試したこと:

What I have tried:

<pre>Input Format

The first line contains four space-separated integers h1, h2, h3, h4 — the colors of horseshoes Valera has.

Constraints

(1 ≤ h1, h2, h3, h4 ≤ 109) Consider all possible colors indexed with integers.

Output Format

Print a single integer — the minimum number of horseshoes Valera needs to buy.

Sample Input 0

1 7 3 3
Sample Output 0

1
Sample Input 1

7 7 7 7
Sample Output 1

3

解決策 1

私たちは立ち往生している人々を喜んで助けますが、それは私たちがあなたのためにすべてをするためにここにいるという意味ではありません! 私たちがすべての作業を行うことはできません。あなたはこれに対して報酬を受け取っているか、またはそれはあなたの成績の一部であり、私たちがあなたのためにすべてを行うことはまったく公平ではありません.

だから私たちはあなたが仕事をする必要があり、あなたが行き詰まったときにあなたを助けます. それは、あなたが提出できる段階的な解決策を提供するという意味ではありません!
現在の状況と、プロセスの次のステップを説明することから始めます。 次に、その次のステップを機能させるために何を試みたか、またその際に何が起こったかを教えてください。

開始するのに問題がある場合は、これが役立つ場合があります。 問題を解決するためのコードの書き方、初心者向けガイド[^]

コメント

タイトルとURLをコピーしました