0
0

場所取り (paizaランク C 相当)

Last updated at Posted at 2023-12-26

参考になったのは

1)とりあえずデータを取得しておく
2)ポップ関数で要素を頭から減らす
3)重複は1つだけにして減らしてB配列として定義
4)出力

N,K,F = map(int,input().split())

A = [int(input()) for _ in range(K)]
for i in range(F):
     A.pop(0)

#重複取り除いたのをB列へ
B = []
for i in range(len(A)):
    if i == 0:
        B.append(A[i])
    else:
        for i in range(len(A)):
            if A[i] not in B:
                B.append(A[i])

#順番はそのままで出力
print(*B,sep="\n")
0
0
2

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