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
- 다이나믹 프로그래밍
- 다익스트라
- 구현
- level2
- 스택
- 파이썬
- python
- 브루트포스
- level0
- 힙
- BFS
- 그리디
- MYSQL
- N과M
- programmers
- 운영체제
- 수학
- level1
- BOJ
- 재귀
- DP
- dfs
- 가상메모리
- level3
- 백준
- 코딩테스트
- 가상메모리 관리
- 딕셔너리
- dict
- 프로그래머스
Archives
- Today
- Total
동캄의 코딩도장
프로그래머스 level0 [다음에 올 숫자] 파이썬 본문
https://school.programmers.co.kr/learn/courses/30/lessons/120924
엄청 오랜만에 글을 쓰는거 같다. 꾸준히 연습해야지...!
def solution(common):
answer = 0
if(common[2]*common[0]==common[1]**2):
if(common[0]==0 and common[1]==0):
answer=0
else:
answer=common[-1]*(common[1]//common[0])
else:
answer=common[-1]+common[1]-common[0]
return answer
먼저 등비수열인지 확인하고, 등비 수열이 아니면 등차가 0인지, 0이 아닌지 확인한다.
'코테 > 프로그래머스 level0' 카테고리의 다른 글
프로그래머스 level0 [겹치는 선분의 길이] 파이썬 (0) | 2023.03.05 |
---|---|
프로그래머스 level0 [평행] 파이썬 (0) | 2023.03.05 |
프로그래머스 level0 [숫자 찾기] 파이썬 (0) | 2023.03.05 |
프로그래머스 level0 [세균 증식] 파이썬 (2) | 2023.03.05 |
프로그래머스 level 0 [종이 자르기] 파이썬 (0) | 2023.03.05 |