CF638A.Home Numbers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The main street of Berland is a straight line with nn houses built along it ( nn is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 11 to n1n-1 in the order from the beginning of the street to the end (in the picture: from left to right). The houses with even numbers are at the other side of the street and are numbered from 22 to nn in the order from the end of the street to its beginning (in the picture: from right to left). The corresponding houses with even and odd numbers are strictly opposite each other, that is, house 11 is opposite house nn , house 33 is opposite house n2n-2 , house 55 is opposite house n4n-4 and so on.

Vasya needs to get to house number aa as quickly as possible. He starts driving from the beginning of the street and drives his car to house aa . To get from the beginning of the street to houses number 11 and nn , he spends exactly 11 second. He also spends exactly one second to drive the distance between two neighbouring houses. Vasya can park at any side of the road, so the distance between the beginning of the street at the houses that stand opposite one another should be considered the same.

Your task is: find the minimum time Vasya needs to reach house aa .

输入格式

The first line of the input contains two integers, nn and aa ( 1<=a<=n<=1000001<=a<=n<=100000 ) — the number of houses on the street and the number of the house that Vasya needs to reach, correspondingly. It is guaranteed that number nn is even.

输出格式

Print a single integer — the minimum time Vasya needs to get from the beginning of the street to house aa .

输入输出样例

  • 输入#1

    4 2
    

    输出#1

    2
    
  • 输入#2

    8 5
    

    输出#2

    3
    

说明/提示

In the first sample there are only four houses on the street, two houses at each side. House 22 will be the last at Vasya's right.

The second sample corresponds to picture with n=8n=8 . House 55 is the one before last at Vasya's left.

首页