Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

如果这题E精度的话就把A*100,然后按整数来做

Posted by JiangLY at 2005-08-19 19:56:29 on Problem 2581
In Reply To:我也是用枚举的啊!为什么错?(Pascal) Posted by:My_loves at 2005-08-19 14:08:52
>  var money:real;
>      num:array[1..4]of integer;
> 
>  procedure init;
>   var i:integer;
>   begin
>    read(money);
>    for i:=1 to 4 do
>     read(num[i]);
>    readln;
>   end;
> 
>  procedure main;
>   var i,j,k:integer;
>       sum:real;
>   begin
>    for i:=num[1] downto 0 do
>     for j:=num[2] downto 0 do
>      for k:=num[3] downto 0 do
>       begin
>        sum:=money-0.25*i-0.1*j-0.05*k;
>        if sum<0 then continue;
>        if (sum=0) or
>           (sum/0.01<=num[4]) then begin
>                                    writeln(i,' ',j,' ',k,' ',sum/0.01:0:0);
>                                    exit;
>                                   end;
>       end;
>    writeln('NO EXACT CHANGE');
>   end;
> 
>  begin
>   repeat
>    init;
>    main;
>   until eof;
>  end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator