Type: Default 1000ms 256MiB

网格

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

【题目描述】

给出一个 n×mn \times m 的网格,其中小明初始站在 xy(x,y) 这个位置,网格内无障碍,小明可以向上下左右四个方向一步走一格,问小明最少走几步可以走出网格。

【输入格式】

第一行四个整数 nmxyn,m,x,y

【输出格式】

一行一个整数表示答案。

【样例输入】

3 3 2 2

【样例输出】

2

【数据范围】

对于 30%30\% 数据 n,m3n,m\leq 3

对于 50%50\% 数据 n,m1000n,m\leq 1000

对于 100%100\% 数据 n,m1000000000n,m\leq 10000000001xn1\leq x\leq n , 1ym1\leq y \leq m

2023CSP考前冲刺模拟1

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2023-9-23 8:30
End at
2023-9-23 12:00
Duration
3.5 hour(s)
Host
Partic.
2