diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-12 16:18:20 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-12 16:18:20 +0700 |
commit | 1a8e1e68759611a66ae116771da5f376c95a3b9f (patch) | |
tree | e663fa6adb9264046a876e552ff2a455215c3a8b /others/volume1/020.pas | |
parent | df9a0d140a7b7edef66f95aa13b5bb4488147f68 (diff) | |
download | cp-1a8e1e68759611a66ae116771da5f376c95a3b9f.tar.gz |
Update others/volume1
Diffstat (limited to 'others/volume1/020.pas')
-rw-r--r-- | others/volume1/020.pas | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/others/volume1/020.pas b/others/volume1/020.pas index 4d11bd2..f37db27 100644 --- a/others/volume1/020.pas +++ b/others/volume1/020.pas @@ -9,24 +9,22 @@ begin 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 + h0 := 0; + l := 0; + while l < n do + for h := l to n - 1 do + if a[h] * a[h + 1] >= 0 then begin - if max < h0 - l0 then + if max < h - l then begin - max := h0 - l0; - l := l0; - h := h0 + max := h - l; + l0 := l; + h0 := h end; - l0 := h0 + 1; + l := h + 1; break end; - writeln(l + 1, ' ', h + 1) -end. + writeln(l0 + 1, ' ', h0 + 1) end. |