比赛 20091110 评测结果 WWWWWWWWWW
题目名称 股票收益 最终得分 0
用户昵称 bly1991 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 09:20:00
显示代码纯文本
  1. program bly(input,output);
  2. var
  3. data:array[1..1000] of real;
  4. f:array[1..1000,1..1000] of real;
  5. i,j:integer;
  6. ans,ans0,max:real;
  7. x0,y0,n,x,m,y:integer;
  8. f1,f2:text;
  9. begin
  10. assign(f1,'stock.in');
  11. reset(f1);
  12. readln(f1,n);
  13. for i:=1 to n do read(f1,data[i]);
  14. readln(f1,m);
  15. close(f1);
  16.  
  17. for i:=1 to n-1 do begin
  18. for j:=i+1 to n do begin
  19. inc(y);
  20. f[i,j]:=data[j]-data[i];
  21. if f[i,j]>0 then inc(x);
  22. if f[i,j]>max then begin
  23. x0:=i;
  24. y0:=j;
  25. max:=f[i,j];
  26. end;
  27. end;
  28. end;
  29.  
  30. assign(f2,'stock.out');
  31. rewrite(f2);
  32. ans:=(m/data[x0])*(data[y0]-data[x0]);
  33. ans0:=x/y;
  34. writeln(f2,ans:0:3);
  35. writeln(f2,ans0:0:3);
  36. close(f2);
  37. end.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.