Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void input(int count, vector<int> v) {
- for (int i = 0;i < count;i++)
- {
- int in;
- cin >> in;
- v.push_back(in);
- }
- }
- int mod(int n, int target, int current, int count)
- {
- while (n % target != 0)
- {
- n -= current;
- count++;
- }
- if (target == 5)
- {
- return mod(n, 10, 5, count);
- }
- else if (target == 10)
- {
- return mod(n, 20, 10, count);
- }
- else if (target == 20)
- {
- return mod(n, 100, 20, count);
- }
- else
- {
- count = count + n / 100;
- return count;
- }
- }
- int main()
- {
- int n;
- cin >> n;
- int c = mod(n, 5, 1, 0);
- cout << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement