发工资咯:)

#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;
}

  

posted @ 2019-07-29 18:14  青衫客36  阅读(189)  评论(0编辑  收藏  举报