比赛 20091110 评测结果 WWWWWWWWWW
题目名称 股票收益 最终得分 0
用户昵称 maxiem 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 11:46:45
显示代码纯文本
program stock;
var
  s:array [1..1000] of double;
  ans,min,max:double;
  n,i,j:integer;
  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];
    if max/min*m>ans then ans:=max/min*m-m;
  end;
  assign (output,'stock.out');
  rewrite (output);
  writeln (ans:0:3);
  for i:=1 to n-1 do for j:=i+1 to n do if s[i]<s[j] then inc(win);
  writeln (win/(n*(n-1)/2):0:3);
  close (output);
end.