250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- html
- 프로그래머스
- Len
- Python3
- 아이엠어바텐더
- 파이썬 몫
- where
- List Comprehension
- 데이터
- Join
- SQL 고득점 Kit
- 슬라이싱
- 단어 공부
- ORDER BY
- Django
- map
- 프로젝트
- GIT
- 백준
- sql
- 코딩테스트 연습
- count
- css
- 설계
- 파이썬 슬라이싱
- YOLOv5
- 파이썬
- pcce 기출문제
- python
- date_format
Archives
- Today
- Total
nan + nan = 2nan
[백준][Python3] #10811. 바구니 뒤집기 본문
728x90
코드 입력
basket_cnt, action_cnt = map(int, input().split())
# 바구니 순서대로 리스트 생성
result = [i for i in range(1, basket_cnt+1)]
for _ in range(action_cnt):
start_idx, end_idx = map(int, input().split())
# 구간별로 슬라이싱하여 [::-1]로 역순 변경
result[start_idx-1:end_idx] = result[start_idx-1:end_idx][::-1]
print(' '.join(map(str, result)))
출처 : 백준 Online Judge
'Python > 백준 알고리즘' 카테고리의 다른 글
[백준][Python3] #9086. 문자열 (0) | 2024.02.28 |
---|---|
[백준][Python3] #2743. 단어 길이 재기 (0) | 2024.02.27 |
[백준][Python3] #10813. 공 바꾸기 (0) | 2024.02.25 |
[백준][Python3] #10810. 공 넣기 (2) | 2024.02.24 |
[백준][Python3] #25314. 코딩은 체육과목 입니다 (0) | 2024.02.23 |
Comments