Skip to content

Commit 120322b

Browse files
committed
Quartz sync: Sep 23, 2025, 12:09 AM
1 parent c65f74f commit 120322b

File tree

16 files changed

+1602
-59
lines changed

16 files changed

+1602
-59
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
tags: ["ps/boj/silver/2", "ps/boj/silver", "cs/algorithms/mathematics/ps","cs/algorithms/dynamic-programming/ps","cs/algorithms/combinatorics/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/10164](https://www.acmicpc.net/problem/10164)
7+
8+
<br/>
9+
10+
# Logic
11+
12+
### *분석*
13+
- 문제 유형 (알고리즘...)
14+
- 제약 조건 (인풋 크기, 예외 값, 시공간 복잡도...)
15+
16+
### *설계*
17+
1. 알고리즘 선택
18+
2. 자료구조 선택
19+
3. 수도 코드 작성
20+
4. 정합판단
21+
- `1 ~ 3`과정으로 도출된 로직이 문제를 해결하는가
22+
- 그렇다 -> **구현**
23+
- 잘 모르겠다 -> **구현**
24+
- 아니다 -> 1번부터 다시 점검
25+
26+
### *구현*
27+
- 로직 검증
28+
29+
### *테스트*
30+
- 예외 케이스 고려
31+
32+
<br/>
33+
34+
# My Code
35+
## cpp
36+
```cpp title="boj/10164.cpp"
37+
// https://www.acmicpc.net/problem/10164
38+
// https://codeyoma.github.io/Computer-Science/1-Foundations--and--Theory/Algorithms/ps/boj/10164/10164
39+
#include <iostream>
40+
using namespace std;
41+
42+
#ifdef LOCAL
43+
# define LOG clog
44+
#else
45+
struct nullstream : ostream {
46+
nullstream()
47+
: ostream(nullptr) {}
48+
};
49+
nullstream LOG;
50+
#endif
51+
52+
void fast_io() {
53+
ios_base::sync_with_stdio(false);
54+
cin.tie(nullptr);
55+
}
56+
57+
//--------------------------------------------------------------------------------------------------
58+
59+
#define MAX (1234567891)
60+
#define MIN (-1234567891)
61+
62+
#include <iostream>
63+
64+
int count_path(int start_row, int start_col, int end_row, int end_col) {
65+
int row_size = end_row - start_row + 1;
66+
int col_size = end_col - start_col + 1;
67+
68+
vector<vector<int>> table(row_size, vector<int>(col_size, 1));
69+
70+
for (int r = 1; r < row_size; ++r) {
71+
for (int c = 1; c < col_size; ++c) {
72+
table[r][c] = table[r - 1][c] + table[r][c - 1];
73+
}
74+
}
75+
76+
return table[row_size - 1][col_size - 1];
77+
}
78+
79+
int main() {
80+
fast_io();
81+
82+
// logic
83+
84+
int n, m, k;
85+
cin >> n >> m >> k;
86+
87+
if (k == 0) {
88+
cout << count_path(0, 0, n - 1, m - 1);
89+
} else {
90+
int row_k = (k - 1) / m;
91+
int col_k = (k - 1) % m;
92+
cout << count_path(0, 0, row_k, col_k) * count_path(row_k, col_k, n - 1, m - 1);
93+
}
94+
}
95+
96+
```
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
tags: ["ps/boj/silver/4", "ps/boj/silver", "cs/algorithms/implementation/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/10656](https://www.acmicpc.net/problem/10656)
7+
8+
<br/>
9+
10+
# Logic
11+
12+
### *분석*
13+
- 문제 유형 (알고리즘...)
14+
- 제약 조건 (인풋 크기, 예외 값, 시공간 복잡도...)
15+
16+
### *설계*
17+
1. 알고리즘 선택
18+
2. 자료구조 선택
19+
3. 수도 코드 작성
20+
4. 정합판단
21+
- `1 ~ 3`과정으로 도출된 로직이 문제를 해결하는가
22+
- 그렇다 -> **구현**
23+
- 잘 모르겠다 -> **구현**
24+
- 아니다 -> 1번부터 다시 점검
25+
26+
### *구현*
27+
- 로직 검증
28+
29+
### *테스트*
30+
- 예외 케이스 고려
31+
32+
<br/>
33+
34+
# My Code
35+
## cpp
36+
```cpp title="boj/10656.cpp"
37+
// https://www.acmicpc.net/problem/10656
38+
// https://codeyoma.github.io/Computer-Science/1-Foundations--and--Theory/Algorithms/ps/boj/10656/10656
39+
#include <iostream>
40+
using namespace std;
41+
42+
#ifdef LOCAL
43+
# define LOG clog
44+
#else
45+
struct nullstream : ostream {
46+
nullstream()
47+
: ostream(nullptr) {}
48+
};
49+
nullstream LOG;
50+
#endif
51+
52+
void fast_io() {
53+
ios_base::sync_with_stdio(false);
54+
cin.tie(nullptr);
55+
}
56+
57+
//--------------------------------------------------------------------------------------------------
58+
59+
#define MAX (1234567891)
60+
#define MIN (-1234567891)
61+
62+
#include <iostream>
63+
#include <string>
64+
#include <vector>
65+
66+
struct coor {
67+
int x;
68+
int y;
69+
};
70+
71+
int main() {
72+
fast_io();
73+
74+
// logic
75+
int n, m;
76+
cin >> n >> m;
77+
78+
vector<string> p(n);
79+
vector<coor> answer;
80+
81+
for (int i = 0; i < n; ++i) {
82+
cin >> p[i];
83+
}
84+
85+
for (const auto& i: p) {
86+
LOG << i << "\n";
87+
}
88+
89+
for (int r = 0; r < n; ++r) {
90+
for (int c = 0; c < m; ++c) {
91+
// 좌우 - 전칸 막혀있고, 뒤에 2개 이상
92+
// 상하 - 위에 막혀있고, 아래로 2개 이상
93+
{
94+
if (c - 1 < 0 || p[r][c - 1] == '#') {
95+
int i = 0;
96+
while (c + i < m) {
97+
if (p[r][c + i] == '.') {
98+
++i;
99+
} else {
100+
break;
101+
}
102+
}
103+
104+
if (i >= 3) {
105+
LOG << r + 1 << " " << c + 1 << "\n";
106+
answer.push_back({ r + 1, c + 1 });
107+
}
108+
}
109+
}
110+
111+
{
112+
if (r - 1 < 0 || p[r - 1][c] == '#') {
113+
int i = 0;
114+
while (r + i < n) {
115+
if (p[r + i][c] == '.') {
116+
++i;
117+
} else {
118+
break;
119+
}
120+
}
121+
122+
if (i >= 3) {
123+
if (!(!answer.empty() && answer.back().x == r + 1 && answer.back().y == c + 1)) {
124+
answer.push_back({ r + 1, c + 1 });
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
132+
cout << answer.size() << "\n";
133+
for (const auto& c: answer) {
134+
cout << c.x << " " << c.y << "\n";
135+
}
136+
}
137+
138+
```
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
tags: ["ps/boj/silver/3", "ps/boj/silver", "cs/algorithms/dynamic-programming/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/11726](https://www.acmicpc.net/problem/11726)
7+
8+
<br/>
9+
10+
# Logic
11+
12+
### *분석*
13+
- 문제 유형 (알고리즘...)
14+
- 제약 조건 (인풋 크기, 예외 값, 시공간 복잡도...)
15+
16+
### *설계*
17+
1. 알고리즘 선택
18+
2. 자료구조 선택
19+
3. 수도 코드 작성
20+
4. 정합판단
21+
- `1 ~ 3`과정으로 도출된 로직이 문제를 해결하는가
22+
- 그렇다 -> **구현**
23+
- 잘 모르겠다 -> **구현**
24+
- 아니다 -> 1번부터 다시 점검
25+
26+
### *구현*
27+
- 로직 검증
28+
29+
### *테스트*
30+
- 예외 케이스 고려
31+
32+
<br/>
33+
34+
# My Code
35+
## cpp
36+
```cpp title="boj/11726.cpp"
37+
// https://www.acmicpc.net/problem/11726
38+
// https://codeyoma.github.io/Computer-Science/1-Foundations--and--Theory/Algorithms/ps/boj/11726/11726
39+
#include <iostream>
40+
using namespace std;
41+
42+
#ifdef LOCAL
43+
# define LOG clog
44+
#else
45+
struct nullstream : ostream {
46+
nullstream()
47+
: ostream(nullptr) {}
48+
};
49+
nullstream LOG;
50+
#endif
51+
52+
void fast_io() {
53+
ios_base::sync_with_stdio(false);
54+
cin.tie(nullptr);
55+
}
56+
57+
//--------------------------------------------------------------------------------------------------
58+
59+
#define MAX (1234567891)
60+
#define MIN (-1234567891)
61+
62+
#include <iostream>
63+
64+
int main() {
65+
fast_io();
66+
67+
// logic
68+
69+
int n;
70+
cin >> n;
71+
72+
int a, b;
73+
74+
a = 0;
75+
b = 1;
76+
77+
while (n--) {
78+
int temp = b;
79+
80+
b = (a + b) % 10'007;
81+
a = temp;
82+
}
83+
84+
cout << b % 10'007;
85+
}
86+
87+
```

0 commit comments

Comments
 (0)