백준 5585 c++

magicdrill·2024년 3월 19일

백준 문제풀이

목록 보기
173/673

백준 5585 c++

#include <iostream>

using namespace std;

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

	int n;
	int count = 0;
	
	cin >> n;
	n = 1000 - n;
	count += (n / 500);
	n = n % 500;
	count += (n / 100);
	n = n % 100;
	count += (n / 50);
	n = n % 50;
	count += (n / 10);
	n = n % 10;
	count += (n / 5);
	n = n % 5;
	count += n;

	cout << count << "\n";

	return 0;
}

0개의 댓글