码迷,mamicode.com
首页 > 其他好文 > 详细

hdu2021

时间:2018-11-20 23:10:06      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:while   style   scan   i++   pre   for   code   ota   ++   

#include<stdio.h>
int main()
{
    int n;
    int i;
    int mny[200];
    int hund,fifty,ten,five,two,one;
    int total;
    while(~scanf("%d",&n))
    {
        total =0;
        if(n==0)
            break;
        for(i=1;i<=n;i++)
        {
            scanf("%d",&mny[i]);
        }
        for(i=1;i<=n;i++)
        {
            hund=mny[i]/100;
            fifty=(mny[i]-100*hund)/50;
            ten=(mny[i]-100*hund-50*fifty)/10;
            five=(mny[i]-100*hund-10*ten-50*fifty)/5;
            two=(mny[i]-100*hund-50*fifty-10*ten-5*five)/2;
            one=mny[i]-100*hund-50*fifty-10*ten-5*five-2*two;
            total=total+hund+fifty+ten+five+two+one;
        }
        printf("%d\n",total);
    }
}

 

hdu2021

标签:while   style   scan   i++   pre   for   code   ota   ++   

原文地址:https://www.cnblogs.com/dlwpkr/p/9991891.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!