Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions flydongwoo/AlgoLeadMe_Week19_prob01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

int N, K;
cin >> N >> K;
vector<int> a(N);

for (int i = 0; i < N; i++) {
cin >> a[i];
}

long long window_sum = 0;

for (int i = 0; i < K; i++) {
window_sum += a[i];
}

long long max_sum = window_sum;

for (int i = K; i < N; i++) {
window_sum += a[i];
window_sum -= a[i - K];
max_sum = max(max_sum, window_sum);
}

cout << max_sum << endl;
return 0;
}
3 changes: 3 additions & 0 deletions flydongwoo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
| 14์ฐจ์‹œ | 2025.07.26 | Greedy Algorithm | [ํšŒ์˜์‹ค ๋ฐฐ์ •](https://www.acmicpc.net/problem/1931)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/54|
| 15์ฐจ์‹œ | 2025.07.27 | DP | [1, 2, 3 ๋”ํ•˜๊ธฐ](https://www.acmicpc.net/problem/9095)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/55|
| 16์ฐจ์‹œ | 2025.08.03 | ๊ตฌํ˜„ | [์ž๋ฆฌ๋ฐฐ์ •](https://www.acmicpc.net/problem/10157)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/60|
| 17์ฐจ์‹œ | 2025.08.06 | DFS์™€ BFS | [๋ฐ”์ด๋Ÿฌ์Šค](https://www.acmicpc.net/problem/2606)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/63|
| 18์ฐจ์‹œ | 2025.08.07 | BFS | [์ˆจ๋ฐ”๊ผญ์งˆ](https://www.acmicpc.net/problem/1697)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/64|
| 19์ฐจ์‹œ | 2025.08.14 | Sliding Window | [์ˆ˜์—ด](https://www.acmicpc.net/problem/2559)|https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/71|