Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
如果这题E精度的话就把A*100,然后按整数来做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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator