fork download
  1. program exetasi1(input,output);
  2. var n,i,j,position,sum0,min : integer;
  3. a : array[1..1000000] of integer;
  4.  
  5. begin
  6. readln(n);
  7. for i := 1 to n do read(a[i]);
  8. if a[1]>0 then sum0 := (a[1] + a[2])
  9. else if a[n]<0 then sum0 := ( a[n] + a[n - 1])
  10. else
  11. begin
  12. sum0 := 2*1000000000;
  13. for i := 1 to n do
  14. begin
  15. if a[n]>0 then do position := a[n-1];
  16. end;
  17. for i := 1 to position do
  18. begin
  19. for j := (position + 1) to (n - 1) do
  20. begin
  21. if abs(a[j])<abs(a[i]) and (abs(a[j + 1]> abs(a[i]) then
  22. begin
  23. if abs(a[i] + a[j])< abs(a[i] + a[j + 1]) then min := abs(a[i] + a[j])
  24. else min := abs(a[i] + a[j + 1])
  25. end;
  26. if abs(min)<abs(sum0) then sum0 := min
  27. end
  28. end
  29. if position<=( n - 2) then
  30. begin
  31. if (a[position + 1] + a[position + 2])<abs(sum0) then sum0 := (a[position + 1] + a[position + 2])
  32. end;
  33. if position >= 3 then
  34. begin
  35. if abs(a[position - 1] + a[position])< abs(sum0) then sum0 := (a[position] + a[position - 1])
  36. end
  37. end;
  38. writeln(sum0)
  39. end.
  40.  
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 2.2.0 [2009/11/16] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling prog.pas
prog.pas(12,16) Warning: range check error while evaluating constants
prog.pas(15,24) Error: Illegal expression
prog.pas(15,27) Error: Illegal expression
prog.pas(15,27) Fatal: Syntax error, ";" expected but "identifier POSITION" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
stdout
Standard output is empty