题库练习 Perfect Squares
← 上一题 下一题 →

A11514 | Perfect Squares

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Given an array $a_{1},a_{2},...,a_{n}$ of $n$ integers, find the largest number in the array that is not a perfect square.

A number $x$ is said to be a perfect square if there exists an integer $y$ such that $x=y^{2}$ .

输入格式

The first line contains a single integer $n$ ( $1<=n<=1000$ ) — the number of elements in the array.

The second line contains $n$ integers $a_{1},a_{2},...,a_{n}$ ( $-10^{6}<=a_{i}<=10^{6}$ ) — the elements of the array.

It is guaranteed that at least one element of the array is not a perfect square.

输出格式

Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.

输入输出样例

输入 #1
2
4 2
输出 #1
2
输入 #2
8
1 2 4 8 16 32 64 576
输出 #2
32
C++ 编辑器
输入
输出