Skip to content

Commit

Permalink
Merge branch 'main' into 9-rivkms
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkms authored Apr 2, 2024
2 parents 78ce0b6 + 8170841 commit 6a0b253
Show file tree
Hide file tree
Showing 20 changed files with 683 additions and 11 deletions.
17 changes: 11 additions & 6 deletions YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
|:----:|:---------:|:----:|:-----:|:----:|
| 1์ฐจ์‹œ | 2024.02.12 | ๊ทธ๋ฆฌ๋”” | [BOJ 18310](https://www.acmicpc.net/problem/18310) | [BOJ 18310 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/3) |
| 2์ฐจ์‹œ | 2024.02.15 | ๊ทธ๋ฆฌ๋”” | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) |
| 3์ฐจ์‹œ | 2024.02.18 | ์Šคํƒ | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) |
| 4์ฐจ์‹œ | 2024.02.21 | ๋ฑ | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) |
| 5์ฐจ์‹œ | 2024.02.21 | ํ | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
| 5์ฐจ์‹œ | 2024.02.21 | ์ •๋ ฌ | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) |
| 01์ฐจ์‹œ | 2024.02.12 | ๊ทธ๋ฆฌ๋”” | [BOJ 18310](https://www.acmicpc.net/problem/18310) | [BOJ 18310 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/3) |
| 02์ฐจ์‹œ | 2024.02.15 | ๊ทธ๋ฆฌ๋”” | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) |
| 03์ฐจ์‹œ | 2024.02.18 | ์Šคํƒ | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) |
| 04์ฐจ์‹œ | 2024.02.21 | ๋ฑ | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) |
| 05์ฐจ์‹œ | 2024.02.24 | ํ | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
| 06์ฐจ์‹œ | 2024.02.27 | ์ •๋ ฌ | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) |
| 07์ฐจ์‹œ | 2024.03.01 | ์žฌ๊ท€ | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) |
| 08์ฐจ์‹œ | 2024.03.04 | ์žฌ๊ท€ | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) |
| 09์ฐจ์‹œ | 2024.03.07 | ์ž„์˜ ์ •๋ฐ€๋„ / ํฐ ์ˆ˜ ์—ฐ์‚ฐ && ์žฌ๊ท€ | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) |
| 10์ฐจ์‹œ | 2024.03.10 | ์Šคํƒ | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) |
| 11์ฐจ์‹œ | 2024.03.18 | ์Šคํƒ | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) |
---
28 changes: 28 additions & 0 deletions YIM2UL2ET/์Šคํƒ/10์ฐจ์‹œ - BOJ 1406.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
#include <stack>

int main(void)
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);

int n;
char ch;
std::string str;
std::stack <char> stk1, stk2;

std::cin >> str >> n;
for (int i = 0; i < str.size(); i++) stk1.push(str[i]);

for (int i = 0; i < n; i++) {
std::cin >> ch;
if (ch == 'L' && !stk1.empty()) stk2.push(stk1.top()), stk1.pop();
else if (ch == 'D' && !stk2.empty()) stk1.push(stk2.top()), stk2.pop();
else if (ch == 'B' && !stk1.empty()) stk1.pop();
else if (ch == 'P') std::cin >> ch, stk1.push(ch);
}

while(stk1.size() > 0) stk2.push(stk1.top()), stk1.pop();
while(stk2.size() > 0) std::cout << stk2.top(), stk2.pop();
return 0;
}
43 changes: 43 additions & 0 deletions YIM2UL2ET/์Šคํƒ/11์ฐจ์‹œ - BOJ 1918.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <iostream>
#include <stack>

int main(void)
{
char ch;
std::stack <char> stk;
std::string res;

ch = getchar();
while (ch != '\n') {
if (ch == '+' || ch == '-') {
while(!stk.empty() && stk.top() != '(') {
res.push_back(stk.top());
stk.pop();
}
stk.push(ch);
}
else if (ch == '*' || ch == '/') {
if (!stk.empty() && (stk.top() == '*' || stk.top() == '/')) {
res.push_back(stk.top());
stk.pop();
}
stk.push(ch);
}
else if (ch == ')') {
while (!stk.empty() && stk.top() != '(') {
res.push_back(stk.top());
stk.pop();
}
if (!stk.empty()) stk.pop();
}
else if (ch == '(') stk.push(ch);
else res.push_back(ch);
ch = getchar();
}
while (!stk.empty()) {
res.push_back(stk.top());
stk.pop();
}
std::cout << res;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <iostream>

std::string FindValue(int n)
{
std::string result = "1";
for (int i = 0; i < n; i++) {
for (int j = 0; j < result.size(); j++) {
result[j] = (result[j] - '0') * 2 + '0';
if (result[j] > '9') {
result[j] -= 10;
if (j == 0) result.insert(result.begin(), '1'), j++;
else result[j-1]++;
}
}
}
result[result.size()-1]--;
return result;
}

void Hanoi(int level, int start, int between, int end)
{
if (level == 1) std::cout << start << " " << end << "\n";
else {
Hanoi(level-1, start, end, between);
std::cout << start << " " << end << "\n";
Hanoi(level-1, between, start, end);
}
return;
}

int main(void) {
int n;
std::cin >> n;
std::cout << FindValue(n) << "\n";
if (!(n > 20)) Hanoi(n, 1, 2, 3);
return 0;
}
23 changes: 23 additions & 0 deletions YIM2UL2ET/์žฌ๊ท€/7์ฐจ์‹œ - BOJ 2705.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>

int ary[1000] = {0};

int solve(int n)
{
if (ary[n-1] != 0) return ary[n-1];
for (int i = 0; n-i*2 > 1;) ary[n-1] += solve(++i);
return ++ary[n-1];
}

int main(void)
{
int n, input;
ary[0] = 1;

std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> input;
std::cout << solve(input) << std::endl;
}
return 0;
}
42 changes: 42 additions & 0 deletions YIM2UL2ET/์žฌ๊ท€/8์ฐจ์‹œ - BOJ 10994.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>

void cover1(int n, int level)
{
for (int i = 0; i < level; i++) std::cout << "* ";
for (int i = 0; i < 4*(n-level)-3; i++) std::cout << "*";
for (int i = 0; i < level; i++) std::cout << " *";
std::cout << "\n";
}

void cover2(int n, int level)
{
for (int i = 0; i < level; i++) std::cout << "* ";
std::cout << "*";
for (int i = 0; i < 4*(n-level)-5; i++) std::cout << " ";
std::cout << "*";
for (int i = 0; i < level; i++) std::cout << " *";
std::cout << "\n";
}

void star(int n, int level)
{
if (n == level+1) {
for (int i = 0; i < n*2-2; i++) std::cout << "* ";
std::cout << "*\n";
}
else {
cover1(n, level);
cover2(n, level);
star(n, level+1);
cover2(n, level);
cover1(n, level);
}
}

int main(void)
{
int n;
std::cin >> n;
star(n, 0);
return 0;
}
16 changes: 16 additions & 0 deletions kjs254/DFS/๋ชจ์Œ์‚ฌ์ „.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def dfs(my_word):
global dic
vowel = ['A','E','I','O','U']

if len(my_word)<=5:
dic.append(my_word)

for v in vowel:
dfs(my_word + v)

def solution(word):
global dic
dic = []
dfs('')
answer = dic.index(word)
return answer
12 changes: 8 additions & 4 deletions kjs254/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
|:----:|:---------:|:----:|:-----:|:----:|
| 1์ฐจ์‹œ | 2024.02.12 | ์Šคํƒ | [๊ธฐ๋Šฅ๊ฐœ๋ฐœ](https://school.programmers.co.kr/learn/courses/30/lessons/42586) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/2) |
| 2์ฐจ์‹œ | 2024.02.15 | ํ | [ํ”„๋กœ์„ธ์Šค](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/6) |
| 3์ฐจ์‹œ | 2024.02.15 | ํž™ | [์•ผ๊ทผ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
| 4์ฐจ์‹œ | 2024.02.15 | ํž™ | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/14) |
| 5์ฐจ์‹œ | 2024.02.15 | ํž™ | [๋ชจ์Œ์‚ฌ์ „](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) |
---
| 3์ฐจ์‹œ | 2024.02.18 | ํž™ | [์•ผ๊ทผ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
| 4์ฐจ์‹œ | 2024.02.21 | ํ | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/14) |
| 5์ฐจ์‹œ | 2024.02.24 | DFS | [๋ชจ์Œ์‚ฌ์ „](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) |
| 6์ฐจ์‹œ | 2024.02.27 | ์Šคํƒ | [๊ด„ํ˜ธ ํšŒ์ „ํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/76502) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/22) |
| 7์ฐจ์‹œ | 2024.03.01 | ๊ตฌํ˜„ | [์บ์‹œ](https://school.programmers.co.kr/learn/courses/30/lessons/17680) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/24) |
| 8์ฐจ์‹œ | 2024.03.08 | ๊ตฌํ˜„ | [ํŠœํ”Œ](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/30) |
| 9์ฐจ์‹œ | 2024.03.10 | ๊ตฌํ˜„ | [๋‰ด์Šค ํด๋Ÿฌ์Šคํ„ฐ๋ง](https://school.programmers.co.kr/learn/courses/30/lessons/17677) | [#33](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/33) |
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
def MakeSet(s): #2๊ธ€์ž์”ฉ ๋Š์€ ์•ŒํŒŒ๋ฒณ๋งŒ ๋ฆฌ์ŠคํŠธ๋กœ ์ถœ๋ ฅ
lst = []
for i,_ in enumerate(s[:-1]):
a = s[i:i+2]
if a.isalpha():
lst.append(a.lower())
return lst

def func(l1, l2): #์ค‘๋ณต ๊ต์ง‘ํ•ฉ๊ณผ ์ค‘๋ณต ํ•ฉ์ง‘ํ•ฉ์˜ ๊ธธ์ด๋ฅผ ๊ฐ๊ฐ ์ถœ๋ ฅ
intersection_set, union_set = [], []
inter = set(l1) & set(l2)
union = set(l1) | set(l2)

for n in union:
intersection_num = min(l1.count(n),l2.count(n))
union_num = max(l1.count(n),l2.count(n))

for _ in range(intersection_num):
intersection_set.append(n)

for _ in range(union_num):
union_set.append(n)

return len(intersection_set), len(union_set)

def solution(str1, str2): #๋ฉ”์ธ ์ฝ”๋“œ
answer = 0

arr1 = MakeSet(str1)
arr2 = MakeSet(str2)

a,b = func(arr1,arr2)

if b:
answer = int((a/b)*65536)
else:
answer = 65536

return answer
25 changes: 25 additions & 0 deletions kjs254/๊ตฌํ˜„/์บ์‹œ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def solution(cacheSize, cities):
answer = 0
cities = [city.lower() for city in cities]
cache, cache_hit = [], []

for i,city in enumerate(cities):
if len(cache)<cacheSize and city not in cache:
cache.append(city)
cache_hit.append(i)
answer +=5

elif city in cache:
cache_hit[cache.index(city)] =i
answer +=1

elif cache:
idx = cache_hit.index(min(cache_hit))
cache[idx] = city
cache_hit[idx] = i
answer +=5

else:
answer+=5

return answer
18 changes: 18 additions & 0 deletions kjs254/๊ตฌํ˜„/ํŠœํ”Œ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def solution(s):
answer = []
dic = {}
s = s.replace('{','').replace('}','').split(',')

for n in s:
n = int(n)
if n not in dic:
dic[n] = 1
else:
dic[n]+= 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse=True)

for d in dic_sorted:
answer.append(d[0])

return answer
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def func(bracket):
stk = []
for b in bracket:
if b in ["[","{","("]:
stk.append(b)
elif b in ["]","}",")"]:
if not stk:
return False
if stk[-1]=="[" and b=="]":
stk.pop()
elif stk[-1]=="{" and b=="}":
stk.pop()
elif stk[-1]=="(" and b==")":
stk.pop()
else:
return False
return not stk

def solution(s):
answer = 0
l = len(s)
for i in range(l):
x = s[i:]+s[:i]
if func(x):
answer +=1

return answer
16 changes: 16 additions & 0 deletions kjs254/ํ/๊ตฌ๋ช…๋ณดํŠธ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from collections import deque

def solution(people, limit):
answer = 0
people = deque(sorted(people))

while len(people)>1:
if people[0]+people[-1]<=limit:
people.pop()
people.popleft()
answer+=1
else:
people.pop()
answer+=1

return answer+1 if people else answer
Loading

0 comments on commit 6a0b253

Please sign in to comment.