about summary refs log tree commit diff
path: root/others/volume1/118.pas
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-22 14:51:37 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-22 14:51:37 +0700
commit7ebfa64719d4ac86b30075c65f21eafe9097853e (patch)
treecf9d59c492bd650258cf139d000d45fb6b8357fb /others/volume1/118.pas
parent7d19f480637e9e880b98dabfbcf8e885b0a2d3b9 (diff)
downloadcp-7ebfa64719d4ac86b30075c65f21eafe9097853e.tar.gz
Updare README.md
Diffstat (limited to 'others/volume1/118.pas')
-rw-r--r--others/volume1/118.pas18
1 files changed, 18 insertions, 0 deletions
diff --git a/others/volume1/118.pas b/others/volume1/118.pas
new file mode 100644
index 0000000..c8008e6
--- /dev/null
+++ b/others/volume1/118.pas
@@ -0,0 +1,18 @@
+var
+  n, i: uint16;
+  a: array of int64;
+
+begin
+  readln(n);
+  setlength(a, n);
+  for i := 0 to n - 1 do
+    read(a[i]);
+  for i := 1 to n - 2 do
+    if (a[i] < a[i - 1]) and
+       (a[i] < a[i + 1]) then
+      begin
+        dec(n);
+        a[i] := a[i - 1]
+      end;
+  writeln(length(a) - n)
+end.