Skip to content

Commit

Permalink
Merge branch 'main' into 31-yuna83
Browse files Browse the repository at this point in the history
  • Loading branch information
yuna83 authored Mar 4, 2024
2 parents 00aec03 + 84d26c3 commit 038e9b7
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Munbin-Lee/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@
| 32์ฐจ์‹œ | 2024.01.30 | ๋ฐฑํŠธ๋ž˜ํ‚น | <a href="https://www.acmicpc.net/problem/17114">ํ•˜์ดํผ ํ† ๋งˆํ† </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/124 |
| 33์ฐจ์‹œ | 2024.02.04 | ์ •์ˆ˜๋ก  | <a href="https://www.acmicpc.net/problem/14905">์†Œ์ˆ˜ 4๊ฐœ์˜ ํ•ฉ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/128 |
| 34์ฐจ์‹œ | 2024.02.06 | ๊ตฌํ˜„ | <a href="https://www.acmicpc.net/problem/1756">ํ”ผ์ž ๊ตฝ๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/133 |
| 35์ฐจ์‹œ | 2024.02.18 | ๋ฐฑํŠธ๋ž˜ํ‚น | <a href="https://www.acmicpc.net/problem/24891">๋‹จ์–ด ๋งˆ๋ฐฉ์ง„</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/140 |
| 36์ฐจ์‹œ | 2024.02.21 | ๋ฌธ์ž์—ด | <a href="https://www.acmicpc.net/problem/15927">ํšŒ๋ฌธ์€ ํšŒ๋ฌธ์•„๋‹ˆ์•ผ!!</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143 |
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <iostream>
#include <unordered_set>

using namespace std;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);

string s;
cin >> s;

if (unordered_set<char>(s.begin(), s.end()).size() == 1) {
cout << "-1";
return 0;
}

auto isPalindrome = [](string &s) {
int lo = 0;
int hi = s.size() - 1; // NOLINT

while (lo < hi) {
if (s[lo] != s[hi]) return false;
lo++;
hi--;
}

return true;
};

if (!isPalindrome(s)) {
cout << s.size();
return 0;
}

cout << s.size() - 1;

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from itertools import permutations

stdin = open(0)

L, N = map(int, stdin.readline().split())
words = sorted(stdin.read().splitlines())

# ๋‹จ์–ด ์ˆœ์—ด x๊ฐ€ ๋‹จ์–ด ๋งˆ๋ฐฉ์ง„์ธ์ง€ ํ™•์ธํ•˜๋Š” ํ•จ์ˆ˜
def isValid(x):
for i in range(L):
for j in range(L):
if x[i][j] != x[j][i]: return False

return True

for perm in permutations(words, L):
if not isValid(perm): continue

print(*perm, sep='\n')
exit()

print('NONE')
16 changes: 16 additions & 0 deletions tgyuuAn/DP/์•ฑ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
total_app_count, need_memory = map(int,input().split())

use_memory = list(map(int,input().split()))
re_use_cost = list(map(int,input().split()))

dp_table = [0 for _ in range(sum(re_use_cost)+1)]
cost_sum = sum(re_use_cost)

for memory, cost in zip(use_memory, re_use_cost):
for idx in range(cost_sum,cost-1,-1):
dp_table[idx] = max(dp_table[idx], dp_table[idx-cost] + memory)

for idx, memory in enumerate(dp_table):
if memory >= need_memory:
print(idx)
break
30 changes: 30 additions & 0 deletions tgyuuAn/DP/์ž…๋Œ€.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sys

remain_days, need_score = map(int,sys.stdin.readline().split())
volunteer_scores = [0]
volunteer_scores.extend(list(map(int,sys.stdin.readline().split())))

blood_donation_score, blood_donation_break_time = map(int,sys.stdin.readline().split())

volunteer_scores.extend([0 for _ in range(blood_donation_break_time-1)])
maximum_blood_donation_count = (len(volunteer_scores)+blood_donation_break_time-1)//blood_donation_break_time+1

dp_table = [[0 for _ in range(maximum_blood_donation_count)] for _ in range(len(volunteer_scores))]

for date in range(len(volunteer_scores)):
if date >= blood_donation_break_time:
for blood_donation_count in range(1,maximum_blood_donation_count):
dp_table[date][blood_donation_count] = max(dp_table[date][blood_donation_count],
dp_table[date-1][blood_donation_count] + volunteer_scores[date],
dp_table[date-blood_donation_break_time][blood_donation_count-1] + blood_donation_score)

dp_table[date][0] = dp_table[date-1][0] + volunteer_scores[date]

print(dp_table)

for count in range(len(dp_table[-1])):
if dp_table[-1][count] >= need_score:
print(count)
break

else: print(-1)
16 changes: 16 additions & 0 deletions tgyuuAn/DP/ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ 3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
target = int(input())

M = 1_000_000
period = 1_500_000

target %= period

dp_table = [0 for _ in range(3)]
dp_table[0] = 0
dp_table[1] = 1

for idx in range(2,target+1):
idx %= 3
dp_table[idx] = dp_table[idx-1] % M + dp_table[idx-2] % M

print(dp_table[target%3]%M)
3 changes: 3 additions & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@
| 35์ฐจ์‹œ | 2023.01.25 | ์ด๋ถ„ ํƒ์ƒ‰ | <a href="https://www.acmicpc.net/problem/2110">๊ณต์œ ๊ธฐ ์„ค์น˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/120
| 36์ฐจ์‹œ | 2023.02.04 | BFS | <a href="https://www.acmicpc.net/problem/4991">๋กœ๋ด‡ ์ฒญ์†Œ๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/126
| 37์ฐจ์‹œ | 2023.02.04 | BFS | <a href="https://www.acmicpc.net/problem/1039">๊ตํ™˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/131
| 38์ฐจ์‹œ | 2023.02.15 | DP | <a href="https://www.acmicpc.net/problem/2749">ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ 3</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137
| 39์ฐจ์‹œ | 2023.02.18 | DP | <a href="https://www.acmicpc.net/problem/7579">์•ฑ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139
| 40์ฐจ์‹œ | 2023.02.21 | DP | <a href="https://www.acmicpc.net/problem/31413">์ž…๋Œ€</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/142
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys
input=sys.stdin.readline

n,x=map(int,input().split())
data=list(map(int,input().split()))

if max(data) == 0:
print("SAD")
else:
value = sum(data[:x]) # x๊ฐœ์”ฉ ์œˆ๋„์šฐ ์ƒ์„ฑ
max_value=value
max_cnt=1

for i in range(x,n):
value+=data[i]
value-=data[i-x]

if value > max_value:
max_value=value
max_cnt =1

elif value == max_value:
max_cnt+=1

print(max_value)
print(max_cnt)

0 comments on commit 038e9b7

Please sign in to comment.