Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

HDU 2021 - 发工资咯:)(贪心)

$
0
0

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2021


#include <stdio.h>

int main(void)
{
    int n, i, x, sum;
    
    while (scanf("%d", &n), n)
    {
        sum = 0;
        for (i = 0 ; i < n ; i++)
        {
            scanf("%d", &x);
            sum += x / 100;
            x %= 100;
            sum += x / 50;
            x %= 50;
            sum += x / 10;
            x %= 10;
            sum += x / 5;
            x %= 5;
            sum += x / 2;
            x %= 2;
            sum += x;
        }
        printf("%d\n", sum);
    }

    return 0;
}


作者:a1006570862 发表于2013-11-27 0:23:22 原文链接
阅读:111 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>