Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8-suhyun113 #32

Merged
merged 6 commits into from
Jul 17, 2024
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
5 changes: 4 additions & 1 deletion suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
| 2μ°¨μ‹œ | 2024.03.29 | μˆ˜ν•™ | [μ†Œμˆ˜ & νŒ°λ¦°λ“œλ‘¬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) |
| 3μ°¨μ‹œ | 2024.04.02 | 그리디 | [κ±°μŠ€λ¦„λˆ](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) |
| 4μ°¨μ‹œ | 2024.04.06 | DP | [ν”Όλ³΄λ‚˜μΉ˜ 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) |
| 5μ°¨μ‹œ | 2024.04.10 | μŠ€νƒ | [크레인 μΈν˜• 뽑기 κ²Œμž„](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) |
| 5μ°¨μ‹œ | 2024.04.10 | μŠ€νƒ | [크레인 μΈν˜• 뽑기 κ²Œμž„](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) |
| 6μ°¨μ‹œ | 2024.04.14 | μŠ€νƒ | [컨트둀 제트](https://school.programmers.co.kr/learn/courses/30/lessons/120853) | [#21](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/21) |
| 7μ°¨μ‹œ | 2024.05.09 | 트리 | [μ›μˆ­μ΄ 맀달기](https://www.acmicpc.net/problem/2716) | [#31](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/31) |
| 8μ°¨μ‹œ | 2024.05.14 | μˆ˜ν•™ | [μ–΄λ¦° μ™•μž](https://www.acmicpc.net/problem/1004) | [#32](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/32) |
42 changes: 42 additions & 0 deletions suhyun113/μˆ˜ν•™/8-suhyun113.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 1004 : μ–΄λ¦° μ™•μž

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int T; // ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€μ˜ 개수
int x1, y1, x2, y2; // 좜발점, 도착점
int n; // ν–‰μ„±μ˜ 개수
int cx, cy, r; // ν–‰μ„±κ³„μ˜ 쀑점과 λ°˜μ§€λ¦„

cin >> T;
while(T--) {
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;

int enter = 0; // μ§„μž… 횟수
int departure = 0; // μ΄νƒˆ 횟수
int count = 0; // μ΅œμ’… μ§„μž…/μ΄νƒˆ 횟수

while(n--) {
cin >> cx >> cy >> r;
float startDistance = sqrt(pow(cx - x1, 2) + pow(cy - y1, 2)); // 좜발점과 원 μ‚¬μ΄μ˜ 거리
float endDistance = sqrt(pow(cx - x2, 2) + pow(cy - y2, 2)); // 도착점과 원 μ‚¬μ΄μ˜ 거리

if (startDistance < r){ // 좜발점이 원 내뢀에 있고,
if (endDistance > r) { // 도착점이 원 외뢀에 있음
departure++; // 좜발점 ν¬ν•¨ν•˜λŠ” ν–‰μ„± -> μ΄νƒˆ 횟수 증가
}
}
if (startDistance > r) { // 좜발점이 원 외뢀에 있고,
if (endDistance < r) { // 도착점이 원 내뢀에 있음
enter++; // 도착점 ν¬ν•¨ν•˜λŠ” ν–‰μ„± -> μ§„μž… 회수 증가
}
}
}
count = enter + departure; // μ΅œμ’… μ§„μž…/μ΄νƒˆ 횟수
cout << count << endl;
}
return 0;
}
20 changes: 20 additions & 0 deletions suhyun113/μŠ€νƒ/6-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def solution(s):
answer = 0

stack = [float("inf")]

# λ¬Έμžμ—΄μ„ 곡백 κΈ°μ€€μœΌλ‘œ λ‚˜λˆ„μ–΄ λ¦¬μŠ€νŠΈμ— μ €μž₯
s_list = s.split()

for i in s_list: # iλŠ” s_list의 μΈλ±μŠ€κ°€ μ•„λ‹Œ κ°’
if i != 'Z':
stack.append(i)
else:
stack.pop() # stack의 κ°€μž₯ μœ„μ˜ κ°’ λΉΌκΈ°
stack.pop(0)

# 문자λ₯Ό μ •μˆ˜λ‘œ λ³€ν™˜ν•˜κΈ°
for i in stack:
n = int(i)
answer += n
return answer
27 changes: 27 additions & 0 deletions suhyun113/트리/7-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 2716 : μ›μˆ­μ΄ 맀달기

N = int(input()) # ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€μ˜ 개수
results = []

for _ in range(N):
s = input().strip()
len_s = len(s)

depth = 0
max_depth = 0

for i in range(len_s):
if (s[i] == '['):
depth += 1
if (depth > max_depth):
max_depth = depth
elif (s[i] == ']'):
depth -= 1

result = 1 #λ‚˜λ¬΄ κΌ­λŒ€κΈ° λ„λ‹¬μœ„ν•΄ μ΅œμ†Œ ν•œ 마리 μ›μˆ­μ΄ ν•„μš”
for _ in range(max_depth):
result *= 2
results.append(result)

for result in results:
print(result)