diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-21 21:09:39 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-21 21:09:39 +0700 |
commit | 7d19f480637e9e880b98dabfbcf8e885b0a2d3b9 (patch) | |
tree | fa52914a2e58bc13570839fa297be05b7b7616bf /others/volume1/081.pas | |
parent | f2d4bc6b7c302dee2d84a3acf84b83b5a98c45fa (diff) | |
download | cp-7d19f480637e9e880b98dabfbcf8e885b0a2d3b9.tar.gz |
Update others/volume1
Diffstat (limited to 'others/volume1/081.pas')
-rw-r--r-- | others/volume1/081.pas | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/others/volume1/081.pas b/others/volume1/081.pas new file mode 100644 index 0000000..11dce4b --- /dev/null +++ b/others/volume1/081.pas @@ -0,0 +1,30 @@ +var + b: array[0..1000001] of boolean; + n, a, i, max: int32; + +begin + for i := 0 to 1000001 do + b[i] := false; + readln(n); + repeat + dec(n); + read(a); + b[a] := true + until n = 0; + max := 1; + while n < 1000000 do + if b[n + 1] and not b[n] then + for i := n + 1 to 1000001 do + begin + if not b[i] then + begin + if i - n > max then + max := i - n; + n := i; + break + end + end + else + inc(n); + writeln(max - 1) +end. |