比赛 20091110 评测结果 WWWWWWWWWW
题目名称 股票收益 最终得分 0
用户昵称 rottenwood 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 10:13:39
显示代码纯文本
  1. program stock;
  2. var
  3. w:array[1..1000] of real;
  4. i,j,k,m,n,t1,tol,c:longint;
  5. min,max,temp,ans,ans1:real;
  6. flag:boolean;
  7. begin
  8. assign(input,'stock.in');reset(input);
  9. assign(output,'stock.out');rewrite(output);
  10. readln(n);
  11. for i:=1 to n do
  12. read(w[i]);
  13. readln(m);
  14. min:=maxlongint;
  15. for i:=1 to n-1 do
  16. for j:=i+1 to n do
  17. begin
  18. inc(tol);
  19. if w[i]<m then flag:=true;
  20. t1:=trunc(m/w[i]);temp:=t1*w[j];ans:=temp-m;
  21. if ans>max then max:=ans;
  22. end;
  23. if not flag then ans:=0 else ans:=max;
  24. writeln(ans:0:3);
  25. for i:=1 to n-1 do
  26. for j:=i+1 to n do
  27. if w[i]<w[j] then inc(c);
  28. ans1:=c/tol;
  29. writeln(ans1:0:3);
  30. close(output);
  31. end.