Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 우분투
- 코로나19
- 파이썬
- ubuntu
- PYTHON
- hackerrank
- Git
- 프로그래머스 파이썬
- 자연어처리
- 캐치카페
- 편스토랑 우승상품
- ChatGPT
- 편스토랑
- 더현대서울 맛집
- dacon
- leetcode
- Baekjoon
- 데이콘
- AI 경진대회
- Docker
- gs25
- Kaggle
- github
- SW Expert Academy
- 백준
- 금융문자분석경진대회
- Real or Not? NLP with Disaster Tweets
- 프로그래머스
- programmers
- 맥북
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 2460번 : 지능형 기차 2 (Python) 본문
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 지능형 기차 2 입니다.
2460번: 지능형 기차 2
최근에 개발된 지능형 기차가 1번역(출발역)부터 10번역(종착역)까지 10개의 정차역이 있는 노선에서 운행되고 있다. 이 기차에는 타거나 내리는 사람 수를 자동으로 인식할 수 있는 장치가 있다.
www.acmicpc.net
👨🏻💻 코드 ( Solution )
def calculate_train_people(current, train_out, train_in):
return current - train_out + train_in
def smart_train_2(in_out_list):
train_people_list = []
current_people = 0
for in_out in in_out_list:
train_out, train_in = map(int, in_out.split())
current_people = calculate_train_people(current_people, train_out, train_in)
train_people_list.append(current_people)
return max(train_people_list)
if __name__ == "__main__":
in_out_list = []
for _ in range(10):
in_out = input()
in_out_list.append(in_out)
print(smart_train_2(in_out_list))
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
| [BaekJoon] 2435번 : 기상청 인턴 신현수 (Python) (0) | 2022.04.22 |
|---|---|
| [BaekJoon] 2845번 : 파티가 끝나고 난 뒤 (Python) (0) | 2022.04.21 |
| [BaekJoon] 11948번 : 과목선택 (Python) (0) | 2022.04.19 |
| [BaekJoon] 2748번 : 피보나치 수 2 (Python) (0) | 2022.04.18 |
| [BaekJoon] 2948번 : 2009년 (Python) (0) | 2022.04.17 |
Comments