#t454. 抓住那头牛
抓住那头牛
Catch the Cow
Problem Description
A farmer knows where a cow is and wants to catch it. The farmer and the cow are on a number line. The farmer starts at position () and the cow is at (). The farmer has two kinds of moves:
-
move from to or , taking one minute;
-
move from to , taking one minute.
Assume the cow does not notice the farmer and stays still. What is the minimum time the farmer needs to catch the cow?
Input Format
Two integers, and .
Output Format
One integer: the minimum number of minutes needed to catch the cow.
Sample Input
5 17
Sample Output
4
Limitation
1 s, 1024 KiB for each test case.