QOJ.ac

QOJ

Time Limit: 0.6 s Memory Limit: 128 MB Total points: 100

#10605. 删除

Statistics

Bajtazar 喜欢玩以下(单人)游戏。黑板上写着从 $a$ 到 $b$ 的所有自然数,构成序列 $$a, a + 1, a + 2, \dots, b - 1, b$$ 随后进行零次或多次移动。在每次移动中,选择黑板上任意两个仍然存在的数字,且这两个数字之和为偶数。将选定的两个数字从黑板上移除。游戏的目标是移除尽可能多的元素。请帮助 Bajtazar 计算这个数字。

输入格式

输入的第一行也是唯一一行包含两个自然数 $a, b$ ($1 \le a \le b \le 10^{18}$),表示 Bajtazar 游戏开始时数字序列的起点和终点。

输出格式

你的程序应输出一行,包含按上述方式可以移除的序列元素的最大数量。

样例

样例输入 1

3 7

样例输出 1

4

说明

例如,可以先移除数字 3 和 5,然后移除数字 4 和 6。

子任务

测试集分为以下子任务。每个子任务的测试由一个或多个独立的测试组组成。

子任务 数据范围 分值
1 $a, b \le 10$ 11
2 $a, b \le 1\,000\,000$ 21
3 $a = 1$ 32
4 无额外限制 36

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.