QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100

#5553. 替代架构

统计

Thomas 在闲暇时非常喜欢摆弄他在阁楼里搭建的乐高模型,他不断地在微缩城市中添加房屋。然而,他开始对底板上那些小凸点所强制要求的完全矩形的布局感到有些厌倦。

在与其他乐高创作者交流后,他发现了一种可以让他以不同角度放置建筑的技术。每座建筑都放置在一个矩形底板上,他在底板的四个角下方各安装了一个圆形的 $1 \times 1$ 乐高件。然后,将这些 $1 \times 1$ 乐高件放置在底板的四个凸点上,如图 A.1 所示。

图 A.1:将 $6 \times 6$ 的底板斜着放置。

如果建筑的底板大小为 $a \times b$ 个凸点,那么使用这种技术,有多少种不同的放置方向,使得四个角上的乐高件能正好卡在底板的凸点上?

图 A.2:第一个样例的示意图。放置 $6 \times 11$ 底板的方法有很多种,但只有 6 种不同的方向。

输入格式

输入包含: * 一行,包含两个整数 $a$ 和 $b$ ($2 \leq a, b \leq 10^6$),表示底板的尺寸。

输出格式

输出一个整数,表示乐高底板可以放置的不同方向的数量。

样例

输入 1

6 11

输出 1

6

输入 2

26 26

输出 2

5

输入 3

123 456

输出 3

2

输入 4

3 3

输出 4

1

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.