Skip to content

Commit

Permalink
Merge pull request #37 from AlgoLeadMe/10-kangrae-jo
Browse files Browse the repository at this point in the history
10-kangrae-jo
  • Loading branch information
kangrae-jo authored Dec 28, 2024
2 parents 4eace8b + 0bdcbf8 commit 93e7326
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kangrae-jo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
| 4μ°¨μ‹œ | 2024.10.05 | BFS | [μ•„μ΄ν…œ 쀍기](https://school.programmers.co.kr/learn/courses/30/lessons/87694)|[#12](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/12)|
| 5μ°¨μ‹œ | 2024.11.02 | DP | [경쟁 λ°°νƒ€μ˜ 원리](https://level.goorm.io/exam/162070/%EA%B2%BD%EC%9F%81-%EB%B0%B0%ED%83%80%EC%9D%98-%EC%9B%90%EB%A6%AC/quiz/1)|[#18](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/18)|
| 6μ°¨μ‹œ | 2024.11.05 | Greedy | [단속카메라](https://school.programmers.co.kr/learn/courses/30/lessons/42884)| [#21](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/21)|
| 7μ°¨μ‹œ | 2024.11.09 | DP | [1둜 λ§Œλ“€κΈ°](https://www.acmicpc.net/problem/1463)|[#12](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/24|)
| 8μ°¨μ‹œ | 2024.11.12 | HEAP | [더 맡게](https://school.programmers.co.kr/learn/courses/30/lessons/42626)|[#27](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/27|)
| 9μ°¨μ‹œ | 2024.11.23 | DP | [μ •μˆ˜ μ‚Όκ°ν˜•](https://school.programmers.co.kr/learn/courses/30/lessons/43105)|[#30](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/30|)
| 7μ°¨μ‹œ | 2024.11.09 | DP | [1둜 λ§Œλ“€κΈ°](https://www.acmicpc.net/problem/1463)|[#12](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/24)|
| 8μ°¨μ‹œ | 2024.11.12 | HEAP | [더 맡게](https://school.programmers.co.kr/learn/courses/30/lessons/42626)|[#27](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/27)|
| 9μ°¨μ‹œ | 2024.11.23 | DP | [μ •μˆ˜ μ‚Όκ°ν˜•](https://school.programmers.co.kr/learn/courses/30/lessons/43105)|[#30](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/30)|
| 10μ°¨μ‹œ | 2024.11.30 | λˆ„μ ν•© | [ꡬ간 ν•© κ΅¬ν•˜κΈ° 4](https://www.acmicpc.net/problem/11659)|[#18](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/37)|

---
30 changes: 30 additions & 0 deletions kangrae-jo/λˆ„μ ν•©/10-kangrae-jo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <iostream>
#include <vector>

using namespace std;

int main() {
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);

int N, M;
cin >> N >> M;

vector<int> num(N + 1, 0);
int temp, sum =0;
for (int i = 1; i <= N; i++) {
cin >> temp;
sum += temp;
num[i] = sum;
}

while (M--) {
int i, j;
cin >> i >> j;

cout << num[j] - num[i-1] << "\n";
}

return 0;
}

0 comments on commit 93e7326

Please sign in to comment.