Peg Test - March 9
Betty the cow loves eating candy canes. Unfortunately, she dropped her candy cane on a 10 × 10 grid. In her confusion, she wandered around and ended up at the lower left hand corner of the grid (1, 1). She also saw that there were some bombs placed on the grid (see diagram below), that she must avoid. Each step she takes now will make her sweat 1 mL, and her steps will always take her to an adjacent square on the grid. Given (x, y) (1 ≤ x,y ≤ 10), the coordinates of her candy cane, calculate the least amount of sweat that Betty sweats to reach her candy cane.
Input contains two integers on a line separated by a space: x and y.
Betty will sweat XmL to get to her candy cane
Xis the minimum number of mL of sweat that Betty must sweat to reach her candy cane.
Sample Input 1
Sample Output 1
Betty will sweat 5mL to get to her candy cane
Sample Input 2
Sample Output 2
Betty will sweat 21mL to get to her candy cane
Point Value: 10 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 10, 2011
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3