2021-06-20 · 1

BOJ 11047 — Coin 0

algorithmboj

This post is over 2 years old. The content may be outdated.

https://www.acmicpc.net/problem/11047 <- the problem


#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int N, K;
    int cnt = 0;
    cin >> N >> K;

    int values[10];

    for(int i = 0; i < N; i++)
    {
        cin >> values[i];
    }
    for(int i = N - 1; i >= 0; i--)
    {
        while(K >= values[i])
        {
            K -= values[i];
            cnt++;
        }
    }
    cout << cnt << "\n";

    return 0;
}

Original (Korean): tistory — published 2021-06-20, migrated to this blog. This translation was generated with the help of AI.

Comments

Delete this comment?

Related posts

BOJ 11047 — Coin 0 · 나봄하랑