#include <iostream>
using namespace std;

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int kg, cnt;
    cin >> kg;
    cnt = kg / 5;
    if (kg % 5 != 0) {
        for (; cnt >= 0; cnt--) {
            if((kg - 5 * cnt) % 3 == 0) {
                cnt += (kg - 5 * cnt) / 3;
                break;
            }
        }
    }

    cout << cnt << '\n';
    return 0;
}

문제 :

https://www.acmicpc.net/problem/2839

'문제풀이 > 백준' 카테고리의 다른 글

1193 - 분수찾기  (0) 2021.08.24
2292 - 벌집  (0) 2021.08.24
1712 - 손익분기점  (0) 2021.08.24
2941 - 크로아티아 알파벳  (0) 2021.08.24
5622 - 다이얼  (0) 2021.08.24

+ Recent posts