LoginSignup
0
0

More than 1 year has passed since last update.

paizaラーニング「【配列の検索】何個ある? Boss Python3編」

Posted at

私の解答

N, M = map(int,input().split())
li = [int(x) for x in input().split()]
print(li.count(N))

解答例1

values = input().split()
N = int(values[0])
M = int(values[1])

A = [0] * M
values = input().split()
for i in range(M):
    A[i] = int(values[i])

ans = 0
for a in A:
    if a == N:
        ans += 1

print(ans)

解答例2

N, M = map(int, input().split())
A = [int(x) for x in input().split()]

print(A.count(N))
0
0
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
0