QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 256 MB Puntuación total: 100

#5038. 都市

Estadísticas

ICPCerの皆さん、西安へようこそ。

西安は美しい古都であり、周、秦、漢、唐の時代の首都でした。長い歴史を持つ西安の通りは、格子状のパターンをしています。

その通りの構造に魅了されたPangコーチは、それらについて研究したいと考えています。彼はボード上に $n \times m$ のグリッドを描きます。このグリッドは $n + 1$ 本の垂直線分と $m + 1$ 本の水平線分で構成されています。垂直線分と水平線分はちょうど $(n + 1) \times (m + 1)$ 個の点で交差し、$n \times m$ 個の単位正方形を形成します。これらの $(n + 1) \times (m + 1)$ 個の交点をグリッド点と呼びます。以下の3つの条件を満たす線分 $l$(垂直や水平なものに限らない)の数を求めてください。

  1. 長さが0ではない。
  2. $l$ の両端点がグリッド点である。
  3. $l$ の中点がグリッド点である。

入力

1行のみで、2つの整数 $n, m$ ($1 \le n, m \le 1000$) が与えられます。

出力

答えを1行で出力してください。

入出力例

入力 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.