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
- 스택
- 컴퓨터공학과
- Stack
- cs
- vector
- c++
- 정석학술정보관
- 오퍼레이팅시스템
- 컴공
- 정석
- 코테
- 브루트포스
- 자료구조
- 백준
- 개발
- 컴공과
- 북리뷰
- OS
- Computer science
- 코딩
- 그래프
- DP
- 구현
- 오에스
- 문제풀이
- 너비우선탐색
- bfs
- 알고리즘
- Operating System
- coding
Archives
- Today
- Total
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