problem code: FLOW005
code
#include <iostream>
#define ll long long
using namespace std;
bool is_decimal(long double number) {
if(number == (ll)number) {
return true;
}else {
return false;
}
}
void calculate_denomination(ll total, ll &count) {
if(total <= 0) {
return;
}
if(is_decimal(total/100.00)) {
count++;
total -= 100;
return calculate_denomination(total, count);
}else if(is_decimal(total/50.00)) {
count++;
total -= 50;
return calculate_denomination(total, count);
}else if(is_decimal(total/10.00)) {
count++;
total -= 10;
return calculate_denomination(total, count);
}else if(is_decimal(total / 5.00)) {
count++;
total -= 5;
return calculate_denomination(total, count);
}else if(is_decimal(total / 2.00)) {
count++;
total -= 2;
return calculate_denomination(total, count);
}else if(is_decimal(total / 1.00)) {
count++;
total -= 1;
return calculate_denomination(total, count);
}
}
int main() {
// your code goes here
ll t;
cin >> t;
for(ll i=0; i<t; i++) {
ll inp; cin >> inp;
ll count = 0;
calculate_denomination(inp, count);
cout << count << "\n";
}
return 0;
}