From df9a0d140a7b7edef66f95aa13b5bb4488147f68 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Sat, 11 Feb 2017 11:37:48 +0700 Subject: Fast and furiously add others/volume1 --- others/volume1/020.pas | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 others/volume1/020.pas (limited to 'others/volume1/020.pas') diff --git a/others/volume1/020.pas b/others/volume1/020.pas new file mode 100644 index 0000000..4d11bd2 --- /dev/null +++ b/others/volume1/020.pas @@ -0,0 +1,32 @@ +var + n, max, l, h, l0, h0: smallint; + a: array of int64; + +begin + readln(n); + setlength(a, n + 1); + for l := 0 to n - 1 do + read(a[l]); + a[n] := 0; + max := 0; + l := 0; + h := 0; + + l0 := 0; + while l0 < n do + for h0 := l0 to n - 1 do + if a[h0] * a[h0 + 1] >= 0 then + begin + if max < h0 - l0 then + begin + max := h0 - l0; + l := l0; + h := h0 + end; + l0 := h0 + 1; + break + end; + + writeln(l + 1, ' ', h + 1) +end. +end. -- cgit 1.4.1