From a373b4d35c36a3c6aa49cc9facce39b21980b6e3 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Fri, 12 Jul 2024 21:07:03 +0900 Subject: [PATCH] complete 2508.py --- zeta_python/completed/2508.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 zeta_python/completed/2508.py diff --git a/zeta_python/completed/2508.py b/zeta_python/completed/2508.py new file mode 100644 index 0000000..5597784 --- /dev/null +++ b/zeta_python/completed/2508.py @@ -0,0 +1,18 @@ +import sys +input = sys.stdin.readline + +if __name__ == '__main__': + T = int(input()) + for _ in range(T): + input() + count = 0 + R, C = map(int, input().split()) + M = [list(input()) for _ in range(R)] + + for r in range(R): + for c in range(C): + if c < C - 2 and M[r][c] == '>' and M[r][c+1] == 'o' and M[r][c+2] == '<': + count += 1 + elif r < R - 2 and M[r][c] == 'v' and M[r+1][c] == 'o' and M[r+2][c] == '^': + count += 1 + print(count) \ No newline at end of file