From 7ebfa64719d4ac86b30075c65f21eafe9097853e Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Wed, 22 Feb 2017 14:51:37 +0700 Subject: Updare README.md --- others/volume1/114.pas | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 others/volume1/114.pas (limited to 'others/volume1/114.pas') diff --git a/others/volume1/114.pas b/others/volume1/114.pas new file mode 100644 index 0000000..927a4af --- /dev/null +++ b/others/volume1/114.pas @@ -0,0 +1,36 @@ +var + m, n, i, j: int16; + h: array[0..1001, 0..1001] of int32; + count: int32 = 0; + +function stupid(x, y: int16): int8; + begin + if h[x][y] > h[x - 1][y] then + exit(0); + if h[x][y] > h[x + 1][y] then + exit(0); + if h[x][y] > h[x][y - 1] then + exit(0); + if h[x][y] > h[x][y + 1] then + exit(0); + stupid := 1 + end; + +begin + readln(m, n); + for i := 1 to m do + for j := 1 to n do + read(h[i][j]); + for i := 0 to m do + h[i][0] := 0; + for i := 1 to m + 1 do + h[i][n + 1] := 0; + for i := 0 to n do + h[0][j] := 0; + for i := 1 to n + 1 do + h[m + 1][i] := 0; + for i := 1 to m do + for j := 1 to n do + inc(count, stupid(i, j)); + writeln(count) +end. -- cgit 1.4.1