https://www.acmicpc.net/problem/10871
n , x = map(int, input().split())
a = list(map(int,input().split()))
for i in range(n):
if a[i] < x:
print(a[i], end =' ')
코드 풀이
n , x = map(int, input().split()) # 비교할 개수 n, 기준 값 x 입력 받기
a = list(map(int,input().split())) # a를 list로 설정하여 입력값 받기
for i in range(n):
if a[i] < x: # 입력한 a[i] 의 값이 기준값 x 보다 작을경우
print(a[i], end =' ') # a[i] 출력
'Python > BOJ' 카테고리의 다른 글
[Python] 백준 10951 A + B - 4 (0) | 2021.08.21 |
---|---|
[Python] 백준 10952 A + B - 5 (0) | 2021.08.21 |
[Python] 합 (0) | 2021.08.11 |
[Python] A + B - 3 (0) | 2021.08.11 |
[Python] 구구단 (0) | 2021.08.11 |