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 |
Tags
- Len
- map
- date_format
- 슬라이싱
- Django
- 아이엠어바텐더
- where
- ORDER BY
- Join
- 프로젝트
- 파이썬 슬라이싱
- 단어 공부
- 데이터
- YOLOv5
- Python3
- html
- 파이썬
- sql
- GIT
- 코딩테스트 연습
- count
- List Comprehension
- pcce 기출문제
- 설계
- 파이썬 몫
- 백준
- SQL 고득점 Kit
- python
- css
- 프로그래머스
Archives
- Today
- Total
nan + nan = 2nan
[백준][Python3] #10810. 공 넣기 본문
728x90
코드 입력
basket_cnt, action_cnt = map(int, input().split())
# 바구니 개수만큼 0을 원소로 갖는 리스트 생성
result = [0 for _ in range(basket_cnt)]
# 공을 바꾸는 횟수만큼 루프문 생성
for _ in range(action_cnt):
start, end, ball_num = map(int, input().split())
# 구간 길이만큼 리스트 생성 후 값 변경
result[start-1:end] = [ball_num]*(end-(start-1))
print(' '.join(map(str, result)))
출처 : 백준 Online Judge
'Python > 백준 알고리즘' 카테고리의 다른 글
[백준][Python3] #10811. 바구니 뒤집기 (0) | 2024.02.26 |
---|---|
[백준][Python3] #10813. 공 바꾸기 (0) | 2024.02.25 |
[백준][Python3] #25314. 코딩은 체육과목 입니다 (0) | 2024.02.23 |
[백준][Python3] #11382. 꼬마 정민 (0) | 2024.02.22 |
[백준][Python3] #2292. 벌집 (0) | 2023.01.16 |
Comments