发工资咯:)
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int salary[6] = {100, 50, 10, 5, 2, 1}; int main() { int n; while(scanf("%d", &n) && n != 0) { int a[n]; int sum = 0; for(int i = 0; i < n; ++ i) { scanf("%d", &a[i]); for(int j = 0; j < 6; ++ j) { sum += a[i] / salary[j]; a[i] = a[i] % salary[j]; } } printf("%d\n", sum); } return 0; }