记录编号 15229 评测结果 AAAAAAAAAA
题目名称 股票收益 最终得分 100
用户昵称 Gravatarmaxiem 是否通过 通过
代码语言 Pascal 运行时间 0.031 s
提交时间 2009-11-11 07:30:55 内存使用 0.12 MiB
显示代码纯文本
program stock;
var
  s:array [1..1000] of double;
  ans,min,max:double;
  n,i,j:integer;
  num,win,m:longint;
begin
  assign (input,'stock.in');
  reset (input);
  readln (n);
  for i:=1 to n do read (s[i]);
  readln (m);
  close (input);
  min:=maxlongint;
  for i:=1 to n do begin
    max:=0;
    if s[i]<min then min:=s[i];
    for j:=i to n do if s[j]>max then max:=s[j];
    num:=trunc(m/min);
    if max*num-min*num>ans then ans:=num*max-min*num;
  end;
  assign (output,'stock.out');
  rewrite (output);
  writeln (ans:0:3);
  win:=0;
  for i:=1 to n-1 do for j:=i+1 to n do if (s[i]<s[j]) and (s[i]<m) then inc(win);
  writeln (win/(n*(n-1)/2):0:3);
  close (output);
end.