Notice
Recent Posts
Recent Comments
Link
Little Jay
[C++] 백준 11047번 동전 0 본문
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, money;
cin >> n >> money;
int temp = 0;
int x;
vector<int> v;
for (int i = 0; i < n; i++) {
cin >> x;
v.push_back(x);
}
sort(v.begin(), v.end());
while (n--) {
int coin = v[n];
if (money - coin >= 0) {
while (money - coin >= 0) {
money -= coin;
temp++;
}
}
}
cout << temp << "\n";
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| 1783번 병든 나이트 (0) | 2021.08.02 |
|---|---|
| [C++] 백준 2875번 대회 or 인턴 (0) | 2021.08.02 |
| [C++] 백준 1874번 스택 수열 (0) | 2021.08.02 |
| [C++] 백준 10799번 쇠막대기 (0) | 2021.08.02 |
| [C++] 백준 17952번 과제는 끝나지 않아! (0) | 2021.08.02 |
Comments