/* *copyright (c) 2014, Yantai University School of computer
*all rights reserved.
* File name: Fun.cpp
* Author: Liu Tiann
* Time: December 14, 2014
* version number: v1.0
* Problem Description: Xiao Ming to the X Cave Expedition, picked up a broken martial arts cheats (more than 2000 pages. Of course it's forged).
he noticed that pages 10th and 11th of the book were on the same sheet, but pages 11th and 12th were not on the same sheet.
Xiao Ming just want to practise the skill of the book from page A to page B, and don't want to take the whole book. How many sheets of paper should he tear off at least.
* Input Description: Enter the start page A and the end page B that Xiaoming wants to practice. (a<b)
* Program output: Output Xiao Ming to take away the paper, each line corresponds to one output result
*/
#include <iostream>
using namespace std;
int main ()
{
int a,b,n;
while (cin>>a>>b)
{
n=b/2-a/2+1;
cout<<n<<endl;
}
return 0;
}
Operation Result: