Skip to content

Commit 377c8a1

Browse files
committed
Quartz sync: Aug 14, 2025, 4:31 PM
1 parent e4751ab commit 377c8a1

File tree

12 files changed

+516
-326
lines changed

12 files changed

+516
-326
lines changed

content/About.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
aliases:
33
description:
44
created: 2025-05-18
5-
modified: 2025-06-12
5+
modified: 2025-08-14
66
title: About
77
comments: "true"
88
---
@@ -15,7 +15,6 @@ comments: "true"
1515

1616
### Reach Me
1717
- [codeyoma@gmail.com](mailto:codeyoma@gmail.com)
18-
- [LinkedIn](https://www.linkedin.com/in/codeyoma)
1918

2019
### Log
2120
- [Blog](https://yoma.kr)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
tags: ["ps/boj/silver/4", "ps/boj/silver", "cs/algorithms/greedy/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/11047](https://www.acmicpc.net/problem/11047)
7+
8+
# Logic
9+
- 쓸 수 있는 가장 큰 동전부터 소모하면서 카운트
10+
- 빼면서 하는 방법
11+
- 몫과, 나머지로 하는 방법
12+
13+
# My Code
14+
15+
## cpp
16+
17+
```cpp title="boj/11047.cpp"
18+
19+
#include <vector>
20+
21+
void solution()
22+
{
23+
int n, k;
24+
25+
cin >> n >> k;
26+
vector<int> w(n);
27+
28+
for (int i = 0; i < n; ++i) {
29+
cin >> w[i];
30+
}
31+
32+
int cnt = 0;
33+
int last_coin_pos = n - 1;
34+
35+
while (k > 0 && last_coin_pos >= 0) {
36+
if ((k / w[last_coin_pos]) >= 1) {
37+
cnt += (k / w[last_coin_pos]);
38+
k %= w[last_coin_pos];
39+
}
40+
last_coin_pos--;
41+
}
42+
cout << cnt;
43+
}
44+
45+
void solution_old()
46+
{
47+
int n, k;
48+
cin >> n >> k;
49+
vector<int> coins(n);
50+
for (int i = 0; i < n; ++i) {
51+
cin >> coins[i];
52+
}
53+
54+
int count = 0;
55+
int pos = n - 1;
56+
while (k || pos >= 0) {
57+
if ((k / coins[pos]) >= 1) {
58+
count += (k / coins[pos]);
59+
k %= coins[pos];
60+
}
61+
pos--;
62+
}
63+
64+
cout << count;
65+
}
66+
67+
68+
```
69+
70+
## python
71+
72+
```python title="boj/11047.py"
73+
74+
75+
76+
def solve():
77+
return
78+
79+
80+
```
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
tags: ["ps/boj/silver/5", "ps/boj/silver", "cs/algorithms/greedy/ps","cs/algorithms/string/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/1439](https://www.acmicpc.net/problem/1439)
7+
8+
# Logic
9+
- 구간이 변하는 지점을 카운트
10+
- 다음중 최소값
11+
- 연속된 1이 차지하는 공간의 개수
12+
- 연속된 0이 차지하는 공간의 개수
13+
- 구간이 변하는 곳 판단 법
14+
- 현재 지점이 이전 지점과 다른경우
15+
- 현재 지점가 0인 경우
16+
- 현재 지점이 1인 경우
17+
18+
# My Code
19+
20+
## cpp
21+
22+
```cpp title="boj/1439.cpp"
23+
24+
#include <vector>
25+
void solution()
26+
{
27+
string s;
28+
29+
cin >> s;
30+
31+
int one_place = 0;
32+
int zero_place = 0;
33+
34+
for (size_t i = 0; i < s.length(); ++i) {
35+
if (i == 0) {
36+
if (s[i] == '0') {
37+
zero_place++;
38+
} else {
39+
one_place++;
40+
}
41+
} else {
42+
if (s[i] != s[i - 1]) {
43+
if (s[i] == '0') {
44+
zero_place++;
45+
} else {
46+
one_place++;
47+
}
48+
}
49+
}
50+
}
51+
52+
cout << min(one_place, zero_place);
53+
}
54+
55+
56+
```
57+
58+
## python
59+
60+
```python title="boj/1439.py"
61+
62+
63+
64+
def solve():
65+
return
66+
67+
68+
```

content/Computer Science/1 Foundations & Theory/Algorithms/ps/boj/18111/18111.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tags:
1515
# Logic
1616

1717
- bruteforce
18-
- $m _ n _ 256 < 1억 $ = bruteforce
18+
- $m * n * 256 < 1억 $ = bruteforce
1919
- 모든 높이에 대해서 최소 도출
2020
- optimize
2121
- 평균을 기준으로 이동
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
tags: ["ps/boj/bronze/1", "ps/boj/bronze", "cs/algorithms/greedy/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/25400](https://www.acmicpc.net/problem/25400)
7+
8+
# Logic
9+
- 정렬되어있으면 제자리 상태
10+
- 1부터 x까지(current_seq) 배열을 순서대로 돌면서 해당 값이라면 패스
11+
- 아니라면 skip++
12+
- skip 출력
13+
14+
# My Code
15+
16+
## cpp
17+
18+
```cpp title="boj/25400.cpp"
19+
20+
#include <vector>
21+
void solution()
22+
{
23+
int n;
24+
cin >> n;
25+
26+
vector<int> v(n);
27+
28+
for (int i = 0; i < n; ++i) {
29+
cin >> v[i];
30+
}
31+
32+
int skip = 0;
33+
int current_seq = 1;
34+
35+
for (const auto& i : v) {
36+
if (i == current_seq) {
37+
current_seq++;
38+
continue;
39+
}
40+
skip++;
41+
}
42+
43+
cout << skip;
44+
}
45+
46+
47+
```
48+
49+
## python
50+
51+
```python title="boj/25400.py"
52+
53+
54+
55+
def solve():
56+
return
57+
58+
59+
```
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
tags: ["ps/boj/bronze/1", "ps/boj/bronze", "cs/algorithms/mathematics/ps","cs/algorithms/greedy/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/28323](https://www.acmicpc.net/problem/28323)
7+
8+
# Logic
9+
- 홀짝 번갈아 나와야 한다
10+
- 다음 중 더 큰값으로?
11+
- 홀로 시작하고 개수 세기
12+
- 짝으로 시작하고 개수 세기
13+
- 개선
14+
- 한번의 반복안에서 플래그로 각 경우 세기
15+
16+
# My Code
17+
18+
## cpp
19+
20+
```cpp title="boj/28323.cpp"
21+
22+
#include <vector>
23+
24+
void solution()
25+
{
26+
int n;
27+
cin >> n;
28+
vector<int> v(n);
29+
for (int i = 0; i < n; ++i) {
30+
cin >> v[i];
31+
}
32+
33+
int odd_start_cnt = 0;
34+
int even_start_cnt = 0;
35+
bool is_odd = true;
36+
bool is_even = true;
37+
38+
for (const auto& i : v) {
39+
if (i & 1) {
40+
if (is_odd) {
41+
odd_start_cnt++;
42+
is_odd = !is_odd;
43+
}
44+
45+
if (!is_even) {
46+
even_start_cnt++;
47+
is_even = !is_even;
48+
}
49+
50+
} else {
51+
if (!is_odd) {
52+
odd_start_cnt++;
53+
is_odd = !is_odd;
54+
}
55+
56+
if (is_even) {
57+
even_start_cnt++;
58+
is_even = !is_even;
59+
}
60+
}
61+
}
62+
63+
cout << max(odd_start_cnt, even_start_cnt);
64+
}
65+
66+
void solution_old()
67+
{
68+
int n;
69+
70+
cin >> n;
71+
72+
vector<int> v(n);
73+
74+
for (int i = 0; i < n; ++i) {
75+
cin >> v[i];
76+
}
77+
78+
int max_cnt = INT_MIN;
79+
bool is_odd = true;
80+
int cnt = 0;
81+
82+
for (const auto& i : v) {
83+
if (i & 1) {
84+
if (is_odd) {
85+
cnt++;
86+
is_odd = !is_odd;
87+
}
88+
} else {
89+
if (!is_odd) {
90+
cnt++;
91+
is_odd = !is_odd;
92+
}
93+
}
94+
}
95+
96+
max_cnt = max(cnt, max_cnt);
97+
cnt = 0;
98+
is_odd = false;
99+
100+
for (const auto& i : v) {
101+
if ((i & 1) == 0) {
102+
if (!is_odd) {
103+
cnt++;
104+
is_odd = !is_odd;
105+
}
106+
} else {
107+
if (is_odd) {
108+
cnt++;
109+
is_odd = !is_odd;
110+
}
111+
}
112+
}
113+
114+
max_cnt = max(cnt, max_cnt);
115+
116+
cout << max_cnt;
117+
}
118+
119+
120+
```
121+
122+
## python
123+
124+
```python title="boj/28323.py"
125+
126+
127+
128+
def solve():
129+
return
130+
131+
132+
```

0 commit comments

Comments
 (0)