Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- thymeleaf
- ์ด๋ถ ํ์
- error
- JPA
- c++
- ๋ถํ ์ ๋ณต
- GCP
- dfs
- ์ฌ๊ท
- ์ฐ์ ์์ ํ
- ์์ ์ ๋ ฌ
- dynamic debugging
- ์คํ
- ์ต๋จ ๊ฒฝ๋ก
- ๊ทธ๋ฆฌ๋
- ๋ฌธ์์ด
- Spring
- BFS
- java
- ๊ตฌํ
- ๋ฐฑํธ๋ํน
- web
- CVE
- ๋งต
- Reversing
- ์๋ฎฌ๋ ์ด์
- DP
- ๋์ ํฉ
- OS
- ๋ฐ์ดํฌ์คํธ๋ผ
Archives
- Today
- Total
hades
[Baekjoon] 11047๋ฒ: ๋์ 0 ๋ณธ๋ฌธ
๐ฅ ๋ฌธ์
https://www.acmicpc.net/problem/11047
๐ ์ค๊ณ
K๋ฅผ ๋ฌ์ฑ์ํค๋ ๋์ ์ ์ต์ ๊ฐ์๋ฅผ ๊ตฌํด์ผ ํ๋๋ฐ, A1 = 1, i ≥ 2์ธ ๊ฒฝ์ฐ์ Ai๋ Ai-1์ ๋ฐฐ์๋ผ๋ ์กฐ๊ฑด์ด ์์ผ๋ฏ๋ก, ๊ฐ์น๊ฐ ํฐ ๋์ ๋ถํฐ ์ต๋ํ ์ฌ์ฉํ๋ ๊ทธ๋ฆฌ๋ ๋ฌธ์ ๋ผ๋ ๊ฒ์ ํ์ ํ ์ ์๋ค.
๐ ํ์ด
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int n, k, result = 0;
vector<int> coins(10);
int main() {
cin >> n >> k;
for (int i=0; i<n; i++){
cin >> coins[i];
}
for (int i=n-1; i>=0; i--){
result += k / coins[i];
k %= coins[i];
}
cout << result << "\n";
return 0;
}
'๐ PS > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Baekjoon] 1012๋ฒ: ์ ๊ธฐ๋ ๋ฐฐ์ถ (0) | 2024.07.02 |
---|---|
[Baekjoon] 1003๋ฒ: ํผ๋ณด๋์น ํฉ (0) | 2024.07.02 |
[Baekjoon] 1920๋ฒ: ์ ์ฐพ๊ธฐ (0) | 2024.07.01 |
[Baekjoon] 1463๋ฒ: 1๋ก ๋ง๋ค๊ธฐ (0) | 2024.07.01 |
[Baekjoon] 1926๋ฒ: ๊ทธ๋ฆผ (0) | 2024.07.01 |