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
- 카카오맵 api
- HTML
- Python
- Template literals
- 프로그래머스
- React #Hooks
- Default parameter
- Nullish Coalescing Operator
- react
- JavaScript
- 카카오맵
- BOJ
- nextjs
- Python #CodeUp
- HTML #CSS
- es6
- spread operation
- Next
- es11
- css #html
- CSS
- firebase
- optional chanining
- Python #Baekjoon
- Hooks
- Redux
- React Kakao map
Archives
- Today
- Total
거북이개발자
[프로그래머스] 모의고사 본문
0. 제목
- 프로그래머스 모의고사
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/42840
코딩테스트 연습 - 모의고사
수포자는 수학을 포기한 사람의 준말입니다. 수포자 삼인방은 모의고사에 수학 문제를 전부 찍으려 합니다. 수포자는 1번 문제부터 마지막 문제까지 다음과 같이 찍습니다. 1번 수포자가 찍는
programmers.co.kr
2. 풀이
- 미리 패턴을 리스트에 2차리스트로 설정한다.
- 반복문을 이용한다,
3. 코드
def solution(answers):
answer = []
man=[[1,2,3,4,5], [2,1,2,3,2,4,2,5], [3,3,1,1,2,2,4,4,5,5]]
score=[0, 0, 0]
for i in range(0, 3):
man_len=len(man[i])
for j in range(0, len(answers)):
if answers[j]==man[i][j%man_len]:
score[i]+=1
for k in range(0,3):
if score[k]==max(score):
answer.append(k+1)
return answer
'Algorithm(Python) > programmers(Lv.1)' 카테고리의 다른 글
[프로그래머스] 크레인 인형뽑기 게임 (0) | 2021.06.23 |
---|---|
[프로그래머스] 소수 만들기 (0) | 2021.06.23 |
[프로그래머스] K번째수 (0) | 2021.06.23 |
[프로그래머스] 내적, 로또의 최고순위와 최저순위 (0) | 2021.06.21 |
[프로그래머스] 음양 더하기 (0) | 2021.06.21 |
Comments