# 奇偶房间号

Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

The main street of Berland is a straight line with n houses built along it (n 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 1 to n - 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 2 to n 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 1 is opposite house n, house 3 is opposite house n - 2, house 5 is opposite house n - 4 and so on.

Vasya needs to get to house number a as quickly as possible. He starts driving from the beginning of the street and drives his car to housea. To get from the beginning of the street to houses number 1 and n, he spends exactly 1 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 a.

Input

The first line of the input contains two integers, n and a (1 ≤ a ≤ n ≤ 100 000) — the number of houses on the street and the number of the house that Vasya needs to reach, correspondingly. It is guaranteed that number n is even.

Output

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

Sample Input

Input
4 2

Output
2

Input
8 5

Output

3

#include<stdio.h>
int main()
{
int n,a;
while(scanf("%d%d",&n,&a)!=EOF)
{
if(a%2==0)
printf("%d\n",(n-a)/2+1);
else
printf("%d\n",(a+1)/2);
}
return 0;
}

• 本文已收录于以下专栏：

## C++实现的BP神经网络算法实现奇偶检验运算

• 2015年11月09日 00:59
• 6KB
• 下载

## 大连理工 数据结构上机 双链表 奇偶

• 2016年09月23日 20:47
• 2KB
• 下载

## Erlang -奇偶并行排序

-module (exe9). -export ([start/2,handle/4]). % L=[2,12,14,25,31,42,43,43,13,34,34,41,41,312,352...
• li8630
• 2015年05月22日 09:36
• 503

## WPS文字设置奇偶页眉的方法步骤

• 2017年04月27日 17:20
• 343KB
• 下载

## 数据校验技术（CRC，奇偶法）

• 2012年08月28日 16:01
• 12KB
• 下载

## 3478 Catch （判断是否为二分图，dfs奇偶染色）

• LiWen_7
• 2012年07月31日 21:48
• 2022

## verilog奇偶分频

• 2014年04月02日 20:03
• 708KB
• 下载

## 奇偶页显示不同内容

• 2014年08月25日 19:14
• 12KB
• 下载

## 【计算机图形学】奇偶规则和非零环绕树规则

• MMogega
• 2016年11月07日 15:34
• 1212

## 奇偶冒泡排序的C语言实现

• 2009年04月24日 22:56
• 164KB
• 下载

举报原因： 您举报文章：奇偶房间号 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)