Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
16 changes: 16 additions & 0 deletions _WeeklyChallenges/W31-[DFS]/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## 🚀7월 3주차 (7/14) 스터디 발제 주제: Graph
> 발제자: 조윤상 (@YoonYn9915)

> [!NOTE]
> 주제: Graph

### 🗂️ 스터디 자료
- PDF: [바로가기](Study_PGS_92342.pdf)

### 📖 문제
- [프로그래머스 #양궁대회](https://school.programmers.co.kr/learn/courses/30/lessons/92342?gad_source=1&gad_campaignid=22799790467&gbraid=0AAAAAC_c4nBqL5si4CBUAklMeq2-iyfsJ&gclid=CjwKCAjwhuHEBhBHEiwAZrvdcv6rZd46q5dPmEW7kLTT7QDV-M4wIY4FCcu6A_NR7SBi2aX37hZjFhoC96gQAvD_BwE): Graph / Level 2
- 정답 코드: [Study_PGS_92342_양궁대회.py](Study_PGS_92342_양궁대회.py)

### 💻 과제
- [백준 #문자열 거리](https://www.acmicpc.net/problem/1230): DP / 골드 1
- 정답 코드: [Assignment_BOJ_1230_문자열거리.py](Assignment_BOJ_1230_문자열거리.py)
Binary file added _WeeklyChallenges/W31-[DFS]/Study_PGS_92342.pdf
Binary file not shown.
30 changes: 30 additions & 0 deletions _WeeklyChallenges/W31-[DFS]/Study_PGS_92342_양궁대회.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def solution(n, info):
global max_gap, answer

answer = [-1]
score = [0] * 11
max_gap = 0

def is_winner_with_gap(score):
a = 0 # 어피치 점수
b = 0 # 라이언 점수

for i in range(len(info)):
if info[i] > 0 or score[i] > 0:
if info[i] >= score[i]:
a += (10 - i)
else:
b += (10 - i)
return (b > a, abs(a - b))

def dfs(L, cnt):
global max_gap, answer
if L == 11 or cnt == 0:
is_winner, gap = is_winner_with_gap(score)
if is_winner:
if cnt >= 0: # 화살이 남은 경우
score[10] = cnt # 0점에 쏴도 이김

if gap > max_gap: # 갭이 더 큰 경우로 업데이트
max_gap = gap
answer = score.copy()
Loading