HBC211820WalkingMachine题解

一沫阳光 算法基础篇 65 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
, you can only go up from this cell, specifically go from. holds, now you should determine the number of cells that one can be out if start walking on it.

Given a maze of size ntimes m n×m, where upper left corner is (1, 1)_{} (1,1) ​ and lower right corner is (n, m)_{} (n,m) ​ . For each cell (x, y)_{} (x,y) ​ , there is exactly one character c~(cin {W, A, S, D}) c (c∈{W,A,S,D}) on it, denoting the moving restriction: * If c = W_{} c=W ​ , you can only go up from this cell, specifically go from (x, y)_{} (x,y) ​ to (x-1, y)_{} (x−1,y) ​ * If c = A_{} c=A ​ , you can only go left from this cell, specifically go from (x, y)_{} (x,y) ​ to (x, y-1)_{} (x,y−1) ​ * If c = S_{} c=S ​ , you can only go down from this cell, specifically go from (x, y)_{} (x,y) ​ to (x+1, y)_{} (x+1,y) ​ * If c = D_{} c=D ​ , you can only go right from this cell, specifically go from (x, y)_{} (x,y) ​ to (x, y+1)_{} (x,y+1) ​ We say one is out if x < 1_{} x<1 ​ or x > n_{} x>n ​ or y < 1_{} y<1 ​ or y > m_{} y>m ​ holds, now you should determine the number of cells that one can be out if start walking on it.

HBC211820WalkingMachine题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC211820WalkingMachine题解