假设五个人工资1053,2014,3038,9154,6814
人民币面值100,50,20,10,1
问取多少张100的多少张50的多少张1元的使每个人都能顺利领到钱,且取钱的总张数最少。

解决方案 »

  1.   

    var a,b,c,d,e,f,g,h,w:integer;
    begin
         w:=strtoint(inputbox('工资金额','请输入工资金额',''));
         a:=w div 100;
         b:=w mod 100;
         c:=b div 50;
         d:=b mod 50;
         e:=d div 20;
         f:=d mod 20;
         g:=f div 10;
         h:=f mod 10;
          showmessage('100元'+inttostr(a)+'张'+'50元'+inttostr(c)+'张'+'20元'+inttostr(e)+'张'+'10元'+inttostr(g)+'张'+'1元'+inttostr(h)+'张');
    end;
    我是这样写的,大大们给我指点指点。初学delphi,呵呵。