0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

問題

袋に$N$個ひなあられが入っているときに、桃色を'P'、白色を'W'、緑色を'G'、黄色を'Y'としたときに袋の中に桃色、白色、緑色の3種類が入っている場合は'Three'、桃色、白色、緑色、黄色の4種類が入っている場合は'Four'と出力する問題。(今回はこのどちらかになることがわかっている)

方針

袋の中の要素の集合を数えて、要素数を数えればよい。

N = int(input())
S = list(input().split())
if len(set(S)) == 3:
    print('Three')
else:
    print('Four')
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?