Description

小明到X山洞探险,捡到一本有破损的武功秘籍(2000多页!当然是伪造的)。
他注意到:书的第10页和第11页在同一张纸上,但第11页和第12页不在同一张纸上 。
小明只想练习该书的第a页到第b页的武功,又不想带着整本书。请问他至少要撕下多少张纸带走?
 

Input

有多组测试实例,输入小明想要练习的起始页a和末尾页b。(a<b)

Output

输出小明最少要带走的纸张,每行对应一个输出结果。

Sample Input

81 92

Sample Output

7
#include<iostream> 
using namespace std; 
int main() 
{int m,n,a; 
while(cin>>n>>m) 
{ 
    a=m-n+2; 
    a=a/2; 
    if(n%2!=0&&m%2==0) 
        a++; 
      
cout<<a<<endl; 
} 
  
  
return 0; 
} 
/************************************************************** 
    Problem: 2508 
    User: 201358505136 
    Language: C++ 
    Result: Accepted 
    Time:4 ms 
    Memory:1268 kb 
****************************************************************/ 


相关文章:

  • 2020-10-28
  • 2018-02-26
  • 2019-01-25
  • 2021-11-17
  • 2020-03-24
  • 2020-04-18
  • 2020-04-21
  • 2018-02-26
猜你喜欢
  • 2021-11-07
  • 2021-09-23
  • 2021-11-13
  • 2021-11-13
  • 2019-03-05
  • 2020-10-26
  • 2021-11-05
  • 2022-01-10
相关资源
相似解决方案