Skip to content

Commit b046162

Browse files
authored
Merge branch 'main' into 7-rivkms
2 parents cd332ae + 16b556f commit b046162

File tree

8 files changed

+129
-1
lines changed

8 files changed

+129
-1
lines changed

โ€ŽYIM2UL2ET/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
| 2์ฐจ์‹œ | 2024.02.15 | ๊ทธ๋ฆฌ๋”” | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) |
77
| 3์ฐจ์‹œ | 2024.02.18 | ์Šคํƒ | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) |
88
| 4์ฐจ์‹œ | 2024.02.21 | ๋ฑ | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) |
9+
| 5์ฐจ์‹œ | 2024.02.21 | ํ | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
10+
| 5์ฐจ์‹œ | 2024.02.21 | ์ •๋ ฌ | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 ํ’€์ด](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) |
911
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
4+
std::string translation(std::string min_str)
5+
{
6+
int s_diff = 0;
7+
std::string alpha_str = min_str;
8+
for (int i = 0; i < min_str.size(); i++) {
9+
if (min_str[i] == 'k') alpha_str[i-s_diff] = 'c';
10+
else if (min_str[i] > 'n') alpha_str[i-s_diff]++;
11+
else if (min_str[i] == 'n' && i+1 < min_str.size() && min_str[i+1] == 'g') {
12+
alpha_str.erase(alpha_str.begin() + (i++) - s_diff);
13+
alpha_str[i - (++s_diff)] = 'o';
14+
}
15+
}
16+
return alpha_str;
17+
}
18+
19+
bool compare(std::string str1, std::string str2)
20+
{
21+
return translation(str1) < translation(str2);
22+
}
23+
24+
int main(void)
25+
{
26+
int n;
27+
std::cin >> n;
28+
29+
std::string min_str[n];
30+
for (int i = 0; i < n; i++) std::cin >> min_str[i];
31+
32+
std::sort(min_str, min_str+n, compare);
33+
34+
for (int i = 0; i < n; i++) std::cout << min_str[i] << std::endl;
35+
return 0;
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
int main(void)
5+
{
6+
int size, k, idx = 0;
7+
std::vector <int> v;
8+
9+
std::cin >> size >> k;
10+
for (int i = 0; i < size;) v.push_back(++i);
11+
12+
std::cout << "<";
13+
while(true) {
14+
idx = (idx + k - 1) % size--;
15+
std::cout << v[idx];
16+
v.erase(v.begin() + idx);
17+
18+
if (size > 0) std::cout << ", ";
19+
else break;
20+
}
21+
std::cout << ">";
22+
23+
return 0;
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def dfs(my_word):
2+
global dic
3+
vowel = ['A','E','I','O','U']
4+
5+
if len(my_word)<=5:
6+
dic.append(my_word)
7+
8+
for v in vowel:
9+
dfs(my_word + v)
10+
11+
def solution(word):
12+
global dic
13+
dic = []
14+
dfs('')
15+
answer = dic.index(word)
16+
return answer

โ€Žkjs254/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
|:----:|:---------:|:----:|:-----:|:----:|
55
| 1์ฐจ์‹œ | 2024.02.12 | ์Šคํƒ | [๊ธฐ๋Šฅ๊ฐœ๋ฐœ](https://school.programmers.co.kr/learn/courses/30/lessons/42586) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/2) |
66
| 2์ฐจ์‹œ | 2024.02.15 | ํ | [ํ”„๋กœ์„ธ์Šค](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/6) |
7-
| 3์ฐจ์‹œ | 2024.02.15 | ํž™ | [์•ผ๊ทผ ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
7+
| 3์ฐจ์‹œ | 2024.02.15 | ํž™ | [์•ผ๊ทผ์ง€์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/12927) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/10) |
8+
| 4์ฐจ์‹œ | 2024.02.15 | ํž™ | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/14) |
9+
| 5์ฐจ์‹œ | 2024.02.15 | ํž™ | [๋ชจ์Œ์‚ฌ์ „](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) |
810
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from collections import deque
2+
3+
def solution(people, limit):
4+
answer = 0
5+
people = deque(sorted(people))
6+
7+
while len(people)>1:
8+
if people[0]+people[-1]<=limit:
9+
people.pop()
10+
people.popleft()
11+
answer+=1
12+
else:
13+
people.pop()
14+
answer+=1
15+
16+
return answer+1 if people else answer
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.io.BufferedReader;
2+
import java.io.IOException;
3+
import java.io.InputStreamReader;
4+
import java.util.StringTokenizer;
5+
6+
public class BOJ10986 {
7+
public static void main(String[] args) throws IOException {
8+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
9+
StringTokenizer st = new StringTokenizer(br.readLine());
10+
11+
int N = Integer.parseInt(st.nextToken());
12+
int M = Integer.parseInt(st.nextToken());
13+
14+
st = new StringTokenizer(br.readLine());
15+
int[] remainders = new int[N + 1]; // ๋ถ€๋ถ„ ํ•ฉ์„ M์œผ๋กœ ๋‚˜๋ˆˆ ๋ฆฌ์ŠคํŠธ
16+
int[] remainders_count = new int[M]; // ๋‚˜๋จธ์ง€ ๊ฐœ์ˆ˜
17+
for (int i = 1; i <= N; i++) {
18+
remainders[i] = (remainders[i - 1] + Integer.parseInt(st.nextToken())) % M;
19+
remainders_count[remainders[i]] += 1;
20+
}
21+
22+
long count = 0;
23+
for (int i = 0; i < M; i++) {
24+
count += (long) remainders_count[i] * (remainders_count[i] - 1) / 2; // ์กฐํ•ฉ
25+
}
26+
27+
count += remainders_count[0]; // ๋‚˜๋จธ์ง€๊ฐ€ 0์ผ๋•Œ (i = j ์ผ๋•Œ)
28+
29+
System.out.println(count);
30+
}
31+
}

โ€Žrivkms/Backtracking/31413.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ int main() {
5151

5252
pair<int, int> p = dfs(0, 0, 0, 0);
5353
cout<< p.first << " " << p.second;
54+
5455
return 0;
5556
}

0 commit comments

Comments
ย (0)