QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 512 MB 満点: 100

#7716. 平均值

統計

给定一个包含 $n$ 个整数的数组 $a$。请找到任意一个下标 $i$ ($1 \le i \le n$),使得元素 $a_i$ 等于其余所有元素的几何平均值。换句话说,找到任意一个满足以下公式的下标 $i$:

$$a_i = \sqrt[n-1]{\prod_{\substack{k=1 \\ k \neq i}}^{n} a_k}$$

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 10^5$):数组的长度。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($a_k \ge 1$;所有数字的总位数不超过 $300\,000$)。

保证对于给定的数组,答案一定存在。

输出格式

输出一个整数:等于其余元素几何平均值的元素的下标。如果存在多个答案,输出其中任意一个即可。

样例

输入 1

5
2 4 8 16 32

输出 1

3

输入 2

2
123456789012345678901234567890 123456789012345678901234567890

输出 2

2

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.