2022-02-22から1日間の記事一覧
atcoder.jp 解法その1 n = int(input()) a = set(input().split()) print(len(a)) Pythonの set は要素の重複を許さないのでそれを使い、要素数を出力 解法その2 n = int(input()) a = list(input().split()) cnt = 1 a.sort() for i in range(n-1): if a[…
atcoder.jp 解法その1 n = int(input()) a = set(input().split()) print(len(a)) Pythonの set は要素の重複を許さないのでそれを使い、要素数を出力 解法その2 n = int(input()) a = list(input().split()) cnt = 1 a.sort() for i in range(n-1): if a[…