比赛 noip-081029 评测结果 AAAAAAW
题目名称 最小乘车费用 最终得分 85
用户昵称 NickName 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-29 21:11:25
显示代码纯文本
program busses;
var
ar:array[1..10] of integer;
cost:array[1..10,1..2] of real;
t:longint;
bi,bo:text;
temp1:real;
temp2:longint;
n:real;
jg:longint;
x1,x2:longint;
begin
assign(bi,'busses.in');
reset(bi);
for x1:=1 to 10 do
begin
read(bi,ar[x1]);
cost[x1,2]:=x1;
cost[x1,1]:=ar[x1]/x1;
end;
readln(bi);
read(bi,n);
close(bi);
for x1:=1 to 9 do
for x2:=x1 to 10 do
if cost[x2,1]<cost[x1,1] then
begin
temp1:=cost[x2,1];
cost[x2,1]:=cost[x1,1];
cost[x1,1]:=temp1;
temp1:=cost[x2,2];
cost[x2,2]:=cost[x1,2];
cost[x1,2]:=temp1;
temp2:=ar[x1];
ar[x1]:=ar[x2];
ar[x2]:=temp2;
end;
for x1:=1 to 10 do
while cost[x1,2]<=n do
begin
n:=n-cost[x1,2];
jg:=jg+ar[x1];
end;
assign(bo,'busses.out');
rewrite(bo);
writeln(bo,jg);
close(bo);
end.