C.cpp 524 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // Created by liuhuan on 18-11-7.
  3. //
  4. #include<bits/stdc++.h>
  5. using namespace std;
  6. int B[] = {100, 50, 20, 10, 5, 2, 1};
  7. int f(int m) {
  8. int tot = 0;
  9. while (m) {
  10. for (int i = 0; i < 7; i++) {
  11. tot += m / B[i];
  12. m %= B[i];
  13. }
  14. }
  15. return tot;
  16. }
  17. int main() {
  18. int m,t;
  19. while (cin >> m) {
  20. if (m == 0)break;
  21. int tot = 0;
  22. while (m--) {
  23. cin >> t;
  24. tot += f(t);
  25. }
  26. cout << tot << endl;
  27. }
  28. return 0;
  29. }