310932: CF1911A. Spy Detected!

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Spy Detected!time limit per test3.0 smemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given an array $a$ consisting of $n$ ($n \ge 3$) positive integers. It is known that in this array, all the numbers except one are the same (for example, in the array $[4, 11, 4, 4]$ all numbers except one are equal to $4$).

Print the index of the element that does not equal others. The numbers in the array are numbered from one.

Input

The first line contains a single integer $t$ ($1 \le t \le 100$). Then $t$ test cases follow.

The first line of each test case contains a single integer $n$ ($3 \le n \le 100$) — the length of the array $a$.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 100$).

It is guaranteed that all the numbers except one in the $a$ array are the same.

Output

For each test case, output a single integer — the index of the element that is not equal to others.

ExampleInput
4
4
11 13 11 11
5
1 4 4 4 4
10
3 3 3 3 10 3 3 3 3 3
3
20 20 10
Output
2
1
5
3

Output

题目大意:
题目是“间谍检测!(Spy Detected!)”。给定一个由n(n≥3)个正整数组成的数组a。已知在这个数组中,除了一个数字外,所有数字都相同(例如,在数组[4, 11, 4, 4]中,除了一个数字外,所有数字都等于4)。

要求打印出不等于其他元素的元素的索引。数组中的数字从一开始编号。

输入输出数据格式:
输入:
- 第一行包含一个整数t(1≤t≤100),表示测试用例的数量。
- 每个测试用例的第一行包含一个整数n(3≤n≤100)——数组a的长度。
- 每个测试用例的第二行包含n个整数a_1, a_2, …, a_n(1≤a_i≤100)。
- 保证数组a中除了一个数字外,所有数字都相同。

输出:
- 对于每个测试用例,输出一个整数——不等于其他元素的元素的索引。

例:
输入:
```
4
4
11 13 11 11
5
1 4 4 4 4
10
3 3 3 3 10 3 3 3 3 3
3
20 20 10
```
输出:
```
2
1
5
3
```

在LaTeX格式中,数学公式如下:
```
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}

\begin{document}

\textbf{题目大意:}
给定一个由$n$($n \ge 3$)个正整数组成的数组$a$。已知在这个数组中,除了一个数字外,所有数字都相同(例如,在数组$[4, 11, 4, 4]$中,除了一个数字外,所有数字都等于4)。

要求打印出不等于其他元素的元素的索引。数组中的数字从一开始编号。

\textbf{输入输出数据格式:}
\textbf{输入:}
- 第一行包含一个整数$t$($1 \le t \le 100$),表示测试用例的数量。
- 每个测试用例的第一行包含一个整数$n$($3 \le n \le 100$)——数组$a$的长度。
- 每个测试用例的第二行包含$n$个整数$a_1, a_2, \ldots, a_n$($1 \le a_i \le 100$)。
- 保证数组$a$中除了一个数字外,所有数字都相同。

\textbf{输出:}
- 对于每个测试用例,输出一个整数——不等于其他元素的元素的索引。

\textbf{例:}
\textbf{输入:}
\begin{align*}
4 \\
4 \\
11 & 13 & 11 & 11 \\
5 \\
1 & 4 & 4 & 4 & 4 \\
10 \\
3 & 3 & 3 & 3 & 10 & 3 & 3 & 3 & 3 & 3 \\
3 \\
20 & 20 & 10 \\
\end{align*}
\textbf{输出:}
\begin{align*}
2 \\
1 \\
5 \\
3 \\
\end{align*}

\end{document}
```题目大意: 题目是“间谍检测!(Spy Detected!)”。给定一个由n(n≥3)个正整数组成的数组a。已知在这个数组中,除了一个数字外,所有数字都相同(例如,在数组[4, 11, 4, 4]中,除了一个数字外,所有数字都等于4)。 要求打印出不等于其他元素的元素的索引。数组中的数字从一开始编号。 输入输出数据格式: 输入: - 第一行包含一个整数t(1≤t≤100),表示测试用例的数量。 - 每个测试用例的第一行包含一个整数n(3≤n≤100)——数组a的长度。 - 每个测试用例的第二行包含n个整数a_1, a_2, …, a_n(1≤a_i≤100)。 - 保证数组a中除了一个数字外,所有数字都相同。 输出: - 对于每个测试用例,输出一个整数——不等于其他元素的元素的索引。 例: 输入: ``` 4 4 11 13 11 11 5 1 4 4 4 4 10 3 3 3 3 10 3 3 3 3 3 3 20 20 10 ``` 输出: ``` 2 1 5 3 ``` 在LaTeX格式中,数学公式如下: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath, amssymb} \begin{document} \textbf{题目大意:} 给定一个由$n$($n \ge 3$)个正整数组成的数组$a$。已知在这个数组中,除了一个数字外,所有数字都相同(例如,在数组$[4, 11, 4, 4]$中,除了一个数字外,所有数字都等于4)。 要求打印出不等于其他元素的元素的索引。数组中的数字从一开始编号。 \textbf{输入输出数据格式:} \textbf{输入:} - 第一行包含一个整数$t$($1 \le t \le 100$),表示测试用例的数量。 - 每个测试用例的第一行包含一个整数$n$($3 \le n \le 100$)——数组$a$的长度。 - 每个测试用例的第二行包含$n$个整数$a_1, a_2, \ldots, a_n$($1 \le a_i \le 100$)。 - 保证数组$a$中除了一个数字外,所有数字都相同。 \textbf{输出:} - 对于每个测试用例,输出一个整数——不等于其他元素的元素的索引。 \textbf{例:} \textbf{输入:} \begin{align*} 4 \\ 4 \\ 11 & 13 & 11 & 11 \\ 5 \\ 1 & 4 & 4 & 4 & 4 \\ 10 \\ 3 & 3 & 3 & 3 & 10 & 3 & 3 & 3 & 3 & 3 \\ 3 \\ 20 & 20 & 10 \\ \end{align*} \textbf{输出:} \begin{align*} 2 \\ 1 \\ 5 \\ 3 \\ \end{align*} \end{document} ```

加入题单

上一题 下一题 算法标签: