16th Week Martial Arts cheats

Source: Internet
Author: User
Tags ming

 /* *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:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.