Advertisement
Gideer

Untitled

Mar 18th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int values[] = {250000000, 100000000,50000000,25000000,10000000,
  5. 5000000,1000000,750000,500000,250000,200000,100000,50000,10000,5000,1000,500,
  6. 100,50,20,10,5};
  7. int cash;
  8.  
  9. void print(int bill){
  10. if(cash < bill) return;
  11. int temp = cash/bill;
  12. cash -= temp*bill;
  13. while (temp--){
  14. std::cout << bill << std::endl;
  15. }
  16. }
  17.  
  18. int main(){
  19. std::cin >> cash;
  20. std::for_each(values,values+22,print);
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement