sqr
Consider a positive integer
n and a1,
a2, ..., an
a sequence made up of n non-zero
positive integers.
Task
Determine the smallest number
which multiplied with the product a1*a2*...*an
is a non-zero perfect square.
Input data
Input file sqr.in
contains on the first line the positive integer n.
On the second line there are n
non-zero positive integers a1
a2 ... an, separated by blanks.
Output data
Output file sqr.out
will contain a single line with a non-zero positive integer, representing the
smallest number which multiplied with the product a1*a2*...*an
is a non-zero perfect square.
Constraints
0 < n <= 1000
0 < ai <= 100000
The result has at most 1000
digits.
Example
sqr.in | sqr.out | Explanation |
3
|
5 |
12*3*5=180 |
Time limit:
0.1 seconds
prof. Marinel
Serban
Liceul de Informatica "Grigore Moisil" Iasi
Contact:marinel_serban@yahoo.com