10813번 - 공 바꾸기
a, b = map(int,input().split()) l = [] for i2 in range(b+1): l.append(i2+1) for i in range(b): c, d = map(int,input().split()) l2 = l[d-1] l3 = l[c-1] l[c-1] = l2 l[d-1] = l3 for j in l: print(j, end=" ") 어떤 부분이 틀렸죠.....?
공의 개수는 b+1이 아닌 a입니다.
감사합니다.
댓글을 작성하려면 로그인해야 합니다.
wlsgud2075 2년 전
a, b = map(int,input().split()) l = [] for i2 in range(b+1): l.append(i2+1) for i in range(b): c, d = map(int,input().split()) l2 = l[d-1] l3 = l[c-1] l[c-1] = l2 l[d-1] = l3 for j in l: print(j, end=" ") 어떤 부분이 틀렸죠.....?