Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11047: 동전 0 #33

Open
minsoo0715 opened this issue Nov 20, 2023 · 0 comments
Open

11047: 동전 0 #33

minsoo0715 opened this issue Nov 20, 2023 · 0 comments
Assignees
Labels
#그리디 그리디 문제 @백준 백준(https://www.acmicpc.net) 문제 C/C++ c/c++로 해결한 문제들

Comments

@minsoo0715
Copy link
Owner

11047: 동전 0

소스 코드

아이디어

동전 개수는 높은 액수의 동전을 가능한 많이 가져올 때 최소가 된다.
-> 그리디

구현

for(int i = N-1; i>=0; --i) {
    if(K < coin[i]) continue;
    if(K == 0) break;
    cnt += K / coin[i];
    K %= coin[i];
}

cout << cnt;
@minsoo0715 minsoo0715 added @백준 백준(https://www.acmicpc.net) 문제 C/C++ c/c++로 해결한 문제들 #그리디 그리디 문제 labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#그리디 그리디 문제 @백준 백준(https://www.acmicpc.net) 문제 C/C++ c/c++로 해결한 문제들
Projects
None yet
Development

No branches or pull requests

1 participant