Skip to content

Commit

Permalink
Merge pull request #59 from AlgoLeadMe/14-wkdghdwns199
Browse files Browse the repository at this point in the history
14-wkdghdwns199
  • Loading branch information
wkdghdwns199 authored Mar 27, 2024
2 parents 1ab6ea1 + 1c578ac commit 392bcc8
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wkdghdwns199/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
| 10차시 | 2024.02.29 | 스택, 큐, 덱 | <a href="https://www.acmicpc.net/problem/18258">큐 2</a> | <a href="">2024.02.29</a> |
| 11차시 | 2024.03.03 | 스택, 큐, 덱 | <a href="https://www.acmicpc.net/problem/11866">요세푸스 문제 0</a> | <a href="">2024.03.03</a> |
| 12차시 | 2024.03.06 | DP | <a href="https://www.acmicpc.net/problem/1010">다리 놓기</a> | <a href="">2024.03.06</a> |
| 13차시 | 2024.03.09 | DP | <a href="https://www.acmicpc.net/problem/1932">정수 삼각형</a> | <a href="">2024.03.09</a> |
| 13차시 | 2024.03.09 | DP | <a href="https://www.acmicpc.net/problem/1932">정수 삼각형</a> | <a href="">2024.03.09</a> |
| 14차시 | 2024.03.13 | 집합과 맵 | <a href="https://www.acmicpc.net/problem/20920">영단어 암기는 괴로워</a> | <a href="">2024.03.13</a> |
17 changes: 17 additions & 0 deletions wkdghdwns199/리뷰풀이/ACM-13975.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys
from heapq import *
input = sys.stdin.readline
T = int(input())
for _ in range(T):
N = int(input())
chapters = list(map(int, input().split()))
time_list = []
min_time=0
for chapter in chapters :
heappush(time_list, chapter)
while len(time_list) > 1 :
temp =0
temp += heappop(time_list) + heappop(time_list)
heappush(time_list, temp)
min_time += temp
print(min_time)
49 changes: 49 additions & 0 deletions wkdghdwns199/리뷰풀이/ACM-16235.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import sys
from collections import deque
input = sys.stdin.readline

dx = [-1,-1,-1,0,0,1,1,1]
dy = [-1,0,1,-1,1,-1,0,1]

N,M,K = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
trees = [[deque() for _ in range(N)] for _ in range(N)]

for _ in range(M) :
x,y,z = map(int, input().split())
trees[x-1][y-1].append(z)

ground = [[5] * N for _ in range(N)]
for _ in range(K) :

for i in range(N) :
for j in range(N):
trees_length = len(trees[i][j])
for k in range(trees_length) :
if ground[i][j] >= trees[i][j][k] :
ground[i][j] -= trees[i][j][k]
trees[i][j][k] += 1
else :
for _ in range(k,trees_length):
ground[i][j] += trees[i][j].pop() // 2
break

for i in range(N):
for j in range(N) :
for z in trees[i][j] :
if z % 5 == 0:
for idx in range(8):
move_x = i + dx[idx]
move_y = j + dy[idx]
if 0 <= move_x < N and 0 <= move_y < N :
trees[move_x][move_y].appendleft(1)
ground[i][j] += A[i][j]

answer = 0
for i in range(N) :
for j in range(N):
answer += len(trees[i][j])
print(answer)



12 changes: 12 additions & 0 deletions wkdghdwns199/리뷰풀이/ACM-1629.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys
input = sys.stdin.readline

def power(A,B,C):
if (B == 1) : return A%C
else :
temp = power(A,B//2, C)
if (B%2 == 0) : return temp * temp % C
else : return temp * temp * A % C

A,B,C = map(int, input().split())
print(power(A,B,C))
20 changes: 20 additions & 0 deletions wkdghdwns199/집합과_맵/ACM-20902.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
word_count = {}
for _ in range(N):
word = input().rstrip()
if len(word) >= M :
if word in word_count :
word_count[word][0] += 1
else :
word_count[word] = [1,len(word)]

print()
for key in word_count :
print (key)

sorted_word_list = sorted(word_count, key=lambda key : (-word_count[key][0], -word_count[key][1], key))
print()
for word in sorted_word_list :
print(word)

0 comments on commit 392bcc8

Please sign in to comment.