Skip to content

Instantly share code, notes, and snippets.

@Shinoryo
Created March 3, 2021 13:54
Show Gist options
  • Save Shinoryo/bf2f369e0a6064f0d42e1ecf07081058 to your computer and use it in GitHub Desktop.
Save Shinoryo/bf2f369e0a6064f0d42e1ecf07081058 to your computer and use it in GitHub Desktop.
This is my code of Problem B of AtCoder Beginner Contest 191.
# 入力
N, X = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
# 配列A'を用意
Aprime = []
for i in range(N):
if A[i] != X:
Aprime.append(A[i])
# 出力(A'が空白の場合を考慮)
if Aprime == []:
print()
else:
Aprimestr = ""
for i in range(len(Aprime)-1):
Aprimestr += str(Aprime[i]) + " "
Aprimestr += str(Aprime[-1])
print(Aprimestr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment