From 560a6d5c0bc06b9ec7a52f373b23ce945ec8889d Mon Sep 17 00:00:00 2001 From: unlockable Date: Sun, 24 Aug 2025 23:45:42 +0800 Subject: [PATCH] =?UTF-8?q?add=20THU=202025=E8=80=83=E7=A0=94a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- thu2025kaoyan_a.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 thu2025kaoyan_a.c diff --git a/thu2025kaoyan_a.c b/thu2025kaoyan_a.c new file mode 100644 index 0000000..59f6f5c --- /dev/null +++ b/thu2025kaoyan_a.c @@ -0,0 +1,55 @@ +#include + +int n; +int h[110][110]; + +int main() { + scanf("%d", &n); + for (int i = 0; i < n; ++i) { + for (int j = 0; j < n; ++j) { + scanf("%d", &h[i][j]); + } + } + + for (int i = 0; i < n; ++i) { + int li, ri, ui, di; + li = 0; + ri = 0; + ui = 0; + di = 0; + // li + int curheight = 0; + for (int j = 0; j < n; ++j) { + if (h[i][j] > curheight) { + li++; + curheight = h[i][j]; + } + } + + curheight = 0; + for (int j = n - 1; j >= 0; --j) { + if (h[i][j] > curheight) { + ri++; + curheight = h[i][j]; + } + } + + curheight = 0; + for (int j = 0; j < n; ++j) { + if (h[j][i] > curheight) { + ui++; + curheight = h[j][i]; + } + } + + curheight = 0; + for (int j = n - 1; j >= 0; --j) { + if (h[j][i] > curheight) { + di++; + curheight = h[j][i]; + } + } + printf("%d %d %d %d\n", li, ri, ui, di); + } + return 0; +} \ No newline at end of file