记录编号 119812 评测结果 AAAAAAAAAA
题目名称 股票收益 最终得分 100
用户昵称 GravatarFoolMike 是否通过 通过
代码语言 Pascal 运行时间 0.014 s
提交时间 2014-09-14 12:49:54 内存使用 0.17 MiB
显示代码纯文本
var
b,c,yl,i,j,s,n,m:longint;
d:int64;
ans,e:real;
a:array[1..1000]of real;
begin
assign(input,'stock.in');
reset(input);
assign(output,'stock.out');
rewrite(output);

read(n);
for b:=1 to n do
read(a[b]);
read(m);
for b:=1 to n-1 do
for c:=b+1 to n do
  begin
  inc(s);
  if (a[b]<a[c])and(m>a[b]) then
    begin
    inc(yl);
    e:=m/a[b];
    if trunc(e)*(a[c]-a[b])>ans then
      begin
      e:=m/a[b];
      ans:=trunc(e)*(a[c]-a[b]);
      i:=b;
      j:=c;
      end;
    end;
  end;

d:=round(ans*1000);
write(d div 1000,'.');
d:=d mod 1000;
if d>=100 then writeln(d);
if (100>d)and(d>=10) then writeln('0',d);
if d<10 then writeln('00',d);

d:=round(yl/s*1000);
write(d div 1000,'.');
d:=d mod 1000;
if d>=100 then writeln(d);
if (100>d)and(d>=10) then writeln('0',d);
if d<10 then writeln('00',d);
close(input);close(output);
end.