QOJ.ac

QOJ

时间限制: 2.0 s 内存限制: 512 MB 总分: 100

#11715. 余波

统计

很久以前,你有一个不错的正整数 $n$。 因为你喜欢除法,你很快找到了它所有的正整数约数。 你并不是一个刻薄的人,你计算了 $a$ —— $n$ 的约数的算术平均值。令人惊讶的是,这个数恰好是一个整数。 一段时间过去了,你计算了 $h$ —— $n$ 的约数的调和平均值。更令人惊讶的是,这个数也恰好是一个整数! 不幸的是,你的记忆力下降了,现在你记得 $a$ 和 $h$,但不记得 $n$ 了。 然而,你记得 $n$ 不超过 $10^{15}$。 你的灵感建议你回到过去,恢复任何符合你记录的 $n$ 值。

输入格式

第一行包含一个正整数 $a$。 第二行包含一个正整数 $h$。 保证存在一个正整数 $n \le 10^{15}$,使得 $n$ 的约数的算术平均值为 $a$,且 $n$ 的约数的调和平均值为 $h$。

输出格式

输出任何不超过 $10^{15}$ 且不与给定信息矛盾的正整数 $n$。

样例

输入 1

3
2

输出 1

6

说明

算术平均值是一组数字之和除以这组数字的个数。例如,1, 2, 3 和 6 的算术平均值等于 $\frac{1+2+3+6}{4} = 3$。 调和平均值是这组数字中各数倒数的算术平均值的倒数。例如,1, 2, 3 和 6 的调和平均值等于 $\left(\frac{1^{-1}+2^{-1}+3^{-1}+6^{-1}}{4}\right)^{-1} = 2$。 因此,在第一个样例测试用例中,$n = 6$ 满足要求,因为它的约数是 1, 2, 3 和 6。

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.