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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.