-
Notifications
You must be signed in to change notification settings - Fork 5
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
15 ljedd2 #174
Merged
Merged
15 ljedd2 #174
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
97c1258
2024-09-07 μμμ΄ λ§€λ¬κΈ°.py
LJEDD2 079a6e5
2024-09-07
LJEDD2 0e8b014
2024-09-08 μμμ΄ λ§€λ¬κΈ°.py
LJEDD2 66752ba
2024-09-11 μΉ΄λ μ λ ¬νκΈ°.py
LJEDD2 1c975ac
2024-09-18 Nλ²μ§Έ ν°μ.py
LJEDD2 3f50541
2024-09-18
LJEDD2 8db95cc
2024-09-21 μΉ΄λ ν©μ²΄ λμ΄.py
LJEDD2 79029cf
Revert "2024-09-18"
LJEDD2 e76ce00
2024-09-26
LJEDD2 a3c8118
2024-09-21
LJEDD2 5522154
2024-09-25 μΉκ΅¬.py
LJEDD2 4109c04
2024-09-25
LJEDD2 7cd3ffe
2024-09-28 μΉ΄λ1.py
LJEDD2 1485ee4
2024-10-02 μΈ κ°μ μμ λ¬Έμ .py
LJEDD2 6f0214b
2024-10-02
LJEDD2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
input = sys.stdin.readline | ||
|
||
# νλμ μμλ₯Ό μ¬λ¬ λ² λν μ μλ€. -> λΈλ£¨νΈν¬μ€ κ°λ₯ | ||
# 5λ³΄λ€ ν° μμμ νμλ‘ μΈ μμμ ν©μ΄ λλμ§ | ||
def search(n): | ||
for i in arr: | ||
for j in arr: | ||
for k in arr: | ||
if i+j+k == n: | ||
return i, j, k | ||
|
||
else: # μλλ©΄ 0 | ||
return 0 | ||
|
||
# μλΌν μ€ν λ€μ€μ 체 - μμ νλ³ | ||
prime = [True] * 1001 | ||
|
||
for i in range(2,101): | ||
if prime[i]: | ||
for j in range(i*2, 1001, i): | ||
prime[j] = False | ||
|
||
# μμ μ°ΎκΈ° | ||
arr = [i for i in range(2, 1001) if prime[i] == True] | ||
|
||
t = int(input()) | ||
for _ in range(t): | ||
n = int(input()) | ||
print(*search(n)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# λ κ°λ¨ν νμ΄ ... (λ¬Έμμ΄) | ||
import sys | ||
input = sys.stdin.readline | ||
|
||
for _ in range(int(input())): | ||
cnt = 0 | ||
s = input().rstrip() | ||
while "[]" in s: | ||
s = s.replace("[]", "") | ||
cnt += 1 | ||
|
||
print(2**cnt) | ||
|
||
|
||
|
||
# import sys | ||
|
||
# input = sys.stdin.readline | ||
|
||
# for _ in range(int(input())): | ||
# s = input().rstrip() # κ΄νΈ λ¬Έμμ΄ | ||
|
||
# max_depth = 0 # μ΅λ κΉμ΄λ₯Ό μ μ₯ν λ³μ | ||
# tree = list() # νμ¬ μ΄λ¦° κ΄νΈλ₯Ό μ μ₯ν μ€νμ | ||
|
||
# for i in s: | ||
# # μ¬λ κ΄νΈμΌ κ²½μ° μ€νμ μ΄λ¦° κ΄νΈ μΆκ° | ||
# if i == '[': | ||
# tree.append('[') | ||
# continue | ||
# # λ«λ κ΄νΈμΌ κ²½μ° | ||
# max_depth = max(len(tree), max_depth) | ||
# # νμ¬ κΉμ΄μ μ΅λ κΉμ΄ μ€ ν° κ°μ μ μ₯νκ³ | ||
# tree.pop() # λ§μ§λ§ μ΄λ¦° κ΄νΈλ₯Ό μ κ±° | ||
|
||
# print(2 ** max_depth) # μμ μ΄λ£°λ κ°μ§ μμ±, κ°μ§2-.1κ°μ© λλ κ°μ§ | ||
# # κ²°κ΅μ 2μ depthμΉ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys, heapq | ||
input = sys.stdin.readline | ||
|
||
n = int(input()) | ||
heap = [] | ||
|
||
for _ in range(n): | ||
for number in map(int, input().split()): | ||
|
||
if len(heap) < n: # λΉκ΅ λμμ΄ λͺ¨μλ κ²½μ° | ||
heapq.heappush(heap, number) #κ·Έλλ‘ μΆκ° | ||
|
||
else: | ||
if number > heap[0]: # μ μΌ μμκ²λ³΄λ€ ν¬λ©΄ | ||
heapq.heapreplace(heap, number) #μμκ±° λΉΌκ³ ν°κ±° λ£μ΄μ€ | ||
|
||
print(heap[0]) # 맨μμ μλκ² Nλ²μ§Έλ‘ ν°λ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import heapq | ||
input = sys.stdin.readline | ||
|
||
cards = list(int(input()) for _ in range(int(input().strip()))) # λ°μ΄ν° μ λ ₯λ°μ | ||
heapq.heapify(cards) # 리μ€νΈλ₯Ό νκ΅¬μ‘°λ‘ λ°κΏμ£Όλ ν¨μ | ||
|
||
result = 0 | ||
while len(cards) > 1 : | ||
f = heapq.heappop(cards) # 첫λ²μ§Έ λν±μ΄ | ||
s = heapq.heappop(cards) # λλ²μ§Έ λν±μ΄ | ||
|
||
result += f+s | ||
|
||
# λ°κΏμΉκΈ° νμκ° μ΅μκ° λκ²λ | ||
heapq.heappush(cards, f+s) | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import heapq | ||
n, m = map(int,input().split()) | ||
|
||
#ν κ΅¬μ‘°λ‘ λ³ν | ||
numbers = list(map(int,input().split())) | ||
heapq.heapify(numbers) | ||
|
||
for _ in range(m): | ||
|
||
x = heapq.heappop(numbers) | ||
y = heapq.heappop(numbers) | ||
|
||
# xμ y λ λ€ κ° κ΅μ²΄ | ||
heapq.heappush(numbers, x+y) | ||
heapq.heappush(numbers, x+y) | ||
|
||
print(sum(numbers)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import sys | ||
from collections import deque | ||
input = sys.stdin.readline | ||
|
||
n = int(input().strip()) | ||
queue = deque([i for i in range(1, n+1)]) | ||
result = [] | ||
|
||
while len(queue) > 1: | ||
result.append(queue.popleft()) | ||
queue.append(queue.popleft()) | ||
else: | ||
result.append(queue.popleft()) | ||
print(" ".join(map(str, result))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import sys | ||
input = sys.stdin.readline | ||
|
||
n = int(input()) | ||
graph = [list(input().strip()) for _ in range(n)] | ||
visited = [[0] * n for _ in range(n)] | ||
|
||
for k in range(n): | ||
for i in range(n): | ||
for j in range(n): | ||
if i == j: | ||
continue | ||
|
||
# 2-μΉκ΅¬μΈ κ²½μ° | ||
if graph[i][j] == 'Y' or (graph[i][k] == 'Y' and graph[k][j] == 'Y'): | ||
visited [i][j] = 1 | ||
|
||
res = 0 | ||
for row in visited: | ||
res = max(res,sum(row)) | ||
print(res) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μμλ₯Ό ꡬν λ μ λ μλ μ½λμ²λΌ ꡬννλλ°, μλΌν μ€ν λ€μ€μ 체λ₯Ό μ΄μ©νλ©΄ μ«μκ° λ 컀μ‘μ λλ μκ° λ³΅μ‘λ μΈ‘λ©΄μμ μ 리νκ² κ΅¬νν μ μκ² λ€μ! μ κ° μ¬μ©ν λ°©μλ λ°±μ€μμλ ν΅κ³ΌλκΈ°λ νμ§λ§, μ«μκ° μ»€μ§μλ‘ λλμ μ°μ°μ΄ λμ΄λμ μ’ λΉν¨μ¨μ μΌ κ±° κ°λ€μ π₯Ή