Bravo And Jadeja
All submissions for this problem are available.
The IPL fever is on. The ‘tyohar ’ is back! Bravo was showing off some cool moves to Sir Jadeja and asked him if he could match those moves. Sir Jadeja couldn’t
do that but he comes up with a different challenge for Bravo.
He gives Bravo an integer L and also provides him with a sequence: L, 2L, 3L.... He asked Bravo to tell him the first number in the sequence that can
be represented as the cube of a positive integer. Bravo tried the number L is given as:L = C1 * C2 * ... * CN (i.e. as a product of N positive integers)
The first line of the input contains an integer T denoting the number of test cases. Each test case consists of 2 lines.
The first line of each test case contains an integer N.
The next line contains N space separated integers, denoting the numbers C1, C2, ..., CN.
For each test case, output a single line containing the first term of the sequence which is the perfect cube, modulo 109+7.
- 1 ≤ T ≤ 10
- 1 ≤ N ≤ 100
- 1 ≤ Ci ≤ 1018
Input: 2 2 2 4 2 3 3 Output: 8 27
In above first test case infinite sequence formed 8,16,24,32,.......First cube in the sequence is 8.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.