Skip to content

Commit

Permalink
Merge branch 'main' into 11-pu2rile
Browse files Browse the repository at this point in the history
  • Loading branch information
pu2rile committed Aug 5, 2024
2 parents 2faf083 + 5538bc9 commit 722e7b7
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 5 deletions.
Binary file added .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions oesnuj/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
| 2μ°¨μ‹œ | 2024.03.29 | μ—°κ²°λ¦¬μŠ€νŠΈ | [에디터](https://www.acmicpc.net/problem/1406) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/8) |
| 3μ°¨μ‹œ | 2024.04.02 | 덱 | [μΉ΄λ“œ 놓기](https://www.acmicpc.net/problem/18115) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/11) |
| 4μ°¨μ‹œ | 2024.04.06 | μŠ€νƒ | [μ˜₯상 정원 κΎΈλ―ΈκΈ°](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) |
| 5μ°¨μ‹œ | 2024.04.13 | 이뢄탐색 | [λ“£λ³΄μž‘](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) |
| 6μ°¨μ‹œ | 2024.05.06 | κΈ°ν•˜ν•™ | [μ •μ‚¬κ°ν˜•](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) |
| 5μ°¨μ‹œ | 2024.04.13 | 이뢄 탐색 | [λ“£λ³΄μž‘](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) |
| 6μ°¨μ‹œ | 2024.05.06 | κΈ°ν•˜ | [μ •μ‚¬κ°ν˜•](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) |
| 7μ°¨μ‹œ | 2024.05.08 | μŠ€νƒ, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) |
| 8μ°¨μ‹œ | 2024.05.13 | μš°μ„ μˆœμœ„ 큐 | [μΉ΄λ“œ μ •λ ¬ν•˜κΈ°](https://www.acmicpc.net/problem/1715) | [#27](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/27) |
| 9μ°¨μ‹œ | 2024.05.30 | κ΅¬ν˜„ | [λΉ™κ³ ](https://www.acmicpc.net/problem/2578) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/30) |
| 10μ°¨μ‹œ | 2024.07.04 | κ΅¬ν˜„ | [μƒμ–΄μ΄ˆλ“±ν•™κ΅](https://www.acmicpc.net/problem/21608) | [#34](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/34) |
| 11μ°¨μ‹œ | 2024.07.18 | 이뢄 탐색 | [λžœμ„  자λ₯΄κΈ°](https://www.acmicpc.net/problem/1654) | [#38](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/38) |
---
2 changes: 0 additions & 2 deletions oesnuj/κ΅¬ν˜„/21608.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,3 @@ function calcSatisfy(){
}
}
return result;
}
좜처: https://oesnuj.tistory.com/entry/Nodejs-λ°±μ€€-Javascript-21608-상어-μ΄ˆλ“±ν•™κ΅ [λΉ„νŠΈλ‘œ κ·Έλ¦¬λŠ” μ„±μž₯일기:ν‹°μŠ€ν† λ¦¬]
35 changes: 35 additions & 0 deletions oesnuj/이뢄 탐색/1654.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <iostream>
#include <vector>
using namespace std;

bool check(vector <int>& v, int n, long long length);
int binary_serach(vector <int>& v, int n);

int main() {
int k, n;
cin >> k >> n;
vector <int> v(k);
for (auto& i : v) {
cin >> i;
}
cout << binary_serach(v, n);
return 0;
}

bool check(vector <int>& v, int n, long long length) {
int cnt = 0;
for (const auto& i : v) {
cnt += i / length;
}
return cnt >= n;
}

int binary_serach(vector <int>& v, int n) {
long long lo = 1, hi = 2147483648; //자λ₯Ό 수 μžˆλŠ” λžœμ„ μ˜ λ²”μœ„
while (lo + 1 < hi) {
long long mid = (lo + hi) / 2;
if (check(v, n, mid)) lo = mid;
else hi = mid;
}
return lo;
}
File renamed without changes.
27 changes: 27 additions & 0 deletions pu2rile/κ΅¬ν˜„/μ˜€λŠ˜λ„ μ‘Œλ‹€.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>

int main() {
int j[9];
int g[9];
int win = 0;
int j_score = 0;
int g_score = 0;

for (int i=0 ; i<9; i++) { //μ œλ―Έλ‹ˆμŠ€ 점수 μž…λ ₯
scanf("%d", &j[i]);
}
for (int i=0 ; i<9; i++) { //κ±Έλ¦¬λ²„μŠ€ 점수 μž…λ ₯
scanf("%d", &g[i]);
}

for (int i=0 ; i<9; i++) {
j_score += j[i]; //μ œλ―Έλ‹ˆμŠ€ 점수 λˆ„μ ν•©(j_score == 총 점수)
if (j_score > g_score) //점수 비ꡐ
win = 1; //μ œλ―Έλ‹ˆμŠ€κ°€ 이겼닀면 win = 1
g_score += g[i]; //κ±Έλ¦¬λ²„μŠ€ 점수 λˆ„μ ν•©(g_score == 총 점수)
}
if (j_score < g_score && win == 1) //μ œλ―Έλ‹ˆμŠ€κ°€ μ‘Œμ§€λ§Œ μ œλ―Έλ‹ˆμŠ€κ°€ 이긴 적이 μžˆλ‹€λ©΄(μ—­μ „νŒ¨)
printf("Yes\n");
else
printf("No\n");
}
Binary file added pu2rile/μŠ€νƒ/.DS_Store
Binary file not shown.
22 changes: 22 additions & 0 deletions pu2rile/μŠ€νƒ/ν™”ν•™μ‹λŸ‰.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
chemical = input()
stack = []
atomic = {'H':1, 'C':12, 'O':16} # μ›μžλŸ‰ λ”•μ…”λ„ˆλ¦¬

for c in chemical:
if c =='(':
stack.append(c)
elif c == 'H' or c == 'C' or c == 'O':
stack.append(atomic[c]) # μž…λ ₯받은 μ›μžμ˜ μ›μžλŸ‰μ„ μŠ€νƒμ— μΆ”κ°€
elif c == ')':
temp = 0 # λ‹«λŠ” κ΄„ν˜Έλ₯Ό λ§Œλ‚˜λ©΄ temp μ΄ˆκΈ°ν™”
while True:
if stack[-1] == '(': # μŠ€νƒμ˜ top이 μ—¬λŠ” κ΄„ν˜Έλ©΄
stack.pop() # μŠ€νƒμ—μ„œ μ—¬λŠ” κ΄„ν˜Έλ₯Ό μ‚­μ œ
stack.append(temp) # μŠ€νƒμ— temp μΆ”κ°€
break
else:
temp += stack.pop() # μ—¬λŠ” κ΄„ν˜Έ μ „κΉŒμ§€μ˜ μŠ€νƒ μ•ˆμ˜ λͺ¨λ“  값을 temp에 μ €μž₯
else: # cκ°€ 숫자라면
stack.append(stack.pop()*int(c)) # μŠ€νƒμ˜ top κ°’κ³Ό 숫자λ₯Ό κ³±ν•˜μ—¬ μŠ€νƒμ— μΆ”κ°€

print(sum(stack))
6 changes: 5 additions & 1 deletion suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
| 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) |
| 6μ°¨μ‹œ | 2024.04.14 | μŠ€νƒ | [컨트둀 제트](https://school.programmers.co.kr/learn/courses/30/lessons/120853) | [#21](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/21) |
| 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) |
| 9μ°¨μ‹œ | 2024.05.28 | λ‹€μ΅μŠ€νŠΈλΌ | [μ΅œμ†ŒλΉ„μš© κ΅¬ν•˜κΈ°](https://www.acmicpc.net/problem/1916) | [#33](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/33) |
| 10μ°¨μ‹œ | 2024.07.13 | ν”Œλ‘œμ΄λ“œ-μ›Œμ…œ | [ν”Œλ‘œμ΄λ“œ](https://www.acmicpc.net/problem/11404) | [#36](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/36) |
36 changes: 36 additions & 0 deletions suhyun113/λ‹€μ΅μŠ€νŠΈλΌ/9-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 1916 : μ΅œμ†ŒλΉ„μš© κ΅¬ν•˜κΈ°

import heapq

INF = float('inf') # μ΅œλŒ€κ°’ μ •μ˜

N = int(input()) # λ„μ‹œμ˜ 개수(λ…Έλ“œ)
M = int(input()) # λ²„μŠ€μ˜ 개수(에지)

graph = [[] for _ in range(N+1)] # κ·Έλž˜ν”„ 인접 리슀트둜 μ΄ˆκΈ°ν™”(λ°©λ¬Έν•˜μ§€ μ•Šμ€ λ…Έλ“œλ“€)
distance = [INF] * (N+1) # 각 λ…Έλ“œκΉŒμ§€μ˜ 거리 λ¬΄ν•œλŒ€λ‘œ μ΄ˆκΈ°ν™”

for _ in range(M):
x, y, cost = map(int, input().split()) # x -> y λ„μ‹œλ‘œ κ°€λŠ” 데 ν•„μš”ν•œ λΉ„μš© cost
graph[x].append([y, cost]) # κ·Έλž˜ν”„μ— 에지 μΆ”κ°€

start, end = map(int, input().split()) # 좜발, 도착 λ…Έλ“œ μž…λ ₯ λ°›κΈ°

# λ‹€μ΅μŠ€νŠΈλΌ μ•Œκ³ λ¦¬μ¦˜
def Dijkstra(start):
q = [] # μš°μ„ μˆœμœ„ 큐 생성
heapq.heappush(q, [0, start]) # μΆœλ°œν•  λ„μ‹œ 큐에 λ„£κΈ°([거리, λ…Έλ“œ] ν˜•νƒœ)
distance[start] = 0 # μ‹œμž‘ λ„μ‹œμ˜ 거리 0으둜 μ΄ˆκΈ°ν™”

while q: # 큐가 빌 λ•ŒκΉŒμ§€ 반볡
weight, node = heapq.heappop(q) # ν˜„μž¬ λ…Έλ“œκΉŒμ§€μ˜ 거리, ν˜„μž¬ λ…Έλ“œ(νμ—μ„œ κ°€μž₯ μž‘μ€ κ°’)
if distance[node] < weight: # ν˜„μž¬ λ…Έλ“œκ°€ 이미 처리된 λ…Έλ“œμΈμ§€ 확인
continue
for n, w in graph[node]:
cost = w + weight # ν˜„μž¬ λ…Έλ“œλ₯Ό 톡해 인접 λ…Έλ“œκΉŒμ§€ κ°€λŠ” μƒˆλ‘œμš΄ 거리 계산
if distance[n] > cost: # μƒˆλ‘œμš΄ 거리가 기쑴에 μ €μž₯된 거리보닀 짧은지 확인
distance[n] = cost # μ΅œλ‹¨ 거리 κ°±μ‹ 
heapq.heappush(q, [cost, n]) # 인접 λ…Έλ“œλ₯Ό μš°μ„ μˆœμœ„ 큐에 μΆ”κ°€

Dijkstra(start)
print(distance[end])
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;
}
41 changes: 41 additions & 0 deletions suhyun113/ν”Œλ‘œμ΄λ“œ-μ›Œμ…œ/10-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 11404 : ν”Œλ‘œμ΄λ“œ
import sys

input = sys.stdin.readline
INF = float('inf') # μ΅œλŒ€κ°’ μ •μ˜

# λ…Έλ“œμ˜ 개수(n)κ³Ό κ°„μ„ μ˜ 개수(m) μž…λ ₯
n = int(input()) # λ„μ‹œμ˜ 개수 n
m = int(input()) # λ²„μŠ€μ˜ 개수 m

# 2차원 리슀트 (κ·Έλž˜ν”„ ν‘œν˜„) λ§Œλ“€κ³ , λ¬΄ν•œλŒ€λ‘œ μ΄ˆκΈ°ν™”(ν”Œλ‘œμ΄λ“œ-μ›Œμ…œ = 이차원 λ°°μ—΄)
graph = [[INF] * (n + 1) for _ in range(n + 1)]

# iμ—μ„œ j둜 갈 수 μ—†λŠ” 경우,
# 자기 μžμ‹ μ—μ„œ 자기 μžμ‹ μœΌλ‘œ κ°€λŠ” λΉ„μš©μ€ 0으둜 μ΄ˆκΈ°ν™”(λŒ€κ°μ„ μ— ν•΄λ‹Ήν•˜λŠ” λΆ€λΆ„))
for i in range(1, n + 1):
for j in range(1, n + 1):
if i == j:
graph[i][j] = 0

# 각 간선에 λŒ€ν•œ 정보λ₯Ό μž…λ ₯λ°›μ•„, κ·Έ κ°’μœΌλ‘œ μ΄ˆκΈ°ν™”
for _ in range(m):
# A -> B둜 κ°€λŠ” λΉ„μš©μ„ C라고 μ„€μ •
i, j, cost = map(int, input().split())
if graph[i][j] > cost: # μ‹œμž‘ λ„μ‹œμ™€ 도착 λ„μ‹œ μ—°κ²°ν•˜λŠ” λ…Έμ„  ν•˜λ‚˜κ°€ x
graph[i][j] = cost

# 점화식에 따라 ν”Œλ‘œμ΄λ“œ μ›Œμ…œ μ•Œκ³ λ¦¬μ¦˜μ„ μˆ˜ν–‰(3쀑 forλ¬Έ)
for k in range(1, n + 1):
for i in range(1, n + 1):
for j in range(1, n + 1):
graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

# μˆ˜ν–‰λœ κ²°κ³Όλ₯Ό 좜λ ₯
for i in range(1, n + 1):
for j in range(1, n + 1):
if graph[i][j] == INF:
print(0, end=' ')
else:
print(graph[i][j], end=' ')
print()

0 comments on commit 722e7b7

Please sign in to comment.