fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int v[6] = {1,5,10,25,50,100};
  8. int q=0;
  9. int valor;
  10. cin >> valor;
  11. for(int i = 5; i >= 0; i--){
  12. while(valor >= v[i]){
  13. valor = valor - v[i];
  14. q++;
  15. }
  16. }
  17. cout << q << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5356KB
stdin
84
stdout
7