QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#5038. 城市

الإحصائيات

欢迎来到西安,各位 ICPC 选手。

西安是一座美丽的古都,曾是周、秦、汉、唐等朝代的都城。西安历史悠久,街道呈网格状分布。

Coach Pang 被这种街道结构所吸引,想要对它们进行研究。他在黑板上画了一个 $n \times m$ 的网格。该网格由 $n + 1$ 条垂直线段和 $m + 1$ 条水平线段组成。垂直线段和水平线段在 $(n + 1) \times (m + 1)$ 个点处相交,形成了 $n \times m$ 个单位正方形。我们将这 $(n + 1) \times (m + 1)$ 个交点称为网格点。请输出满足以下三个条件的线段 $l$(不限于垂直或水平线段)的数量:

  1. 长度不为零。
  2. $l$ 的两个端点均为网格点。
  3. $l$ 的中点为网格点。

输入格式

仅一行,包含两个整数 $n, m(1 \le n, m \le 1000)$。

输出格式

输出一行答案。

样例

样例输入 1

1 1

样例输出 1

0

样例输入 2

2 3

样例输出 2

14

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.