• [G] Chihuo VII - Hunt Down

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Zhengling has found that Tianyi bury some evidence that she had eaten. So Zhengling decides to give her some lessons.
    But Tianyi is so afraid that she couldn't help run away.
    Of course, Zhengling will hunt her down.

    The area is a square N * M. Tianyi will run away from the left-bottom corner to the upper-side. Then will she run from the upper-side to the bottom-side. Last she will run from the bottom-side to the right-upper corner.
    Can you tell Tianyi that the minimum distance she will run?

  • 输入
  • This problem contains several cases. Each case contains two integers N, M(1 <= N, M <= 10000), indicate the width and height of the area.
    Input until 0 0.
  • 输出
  • For each case, you should output the result. Rounded to the nearest integer.
  • 样例输入
  • 2 1
    1 1
    1 2
    0 0
    
  • 样例输出
  • 4
    3
    6
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜