Homework For A Trip
All submissions for this problem are available.
Little Bob wants to go to the amusement park with his friends in Byteland.
Since, he has pending homework, his mother doesn't want him to go to the amusement park. Your task is to help him with his homework, he has an extra pass which he will give to you if you help him :)
You will be given a set of numbers, out of these numbers you have to select a tuple of six values (a,b,c,d,e,f) such that the following property is satisfied :-
1) (a*b) + c = d*(e+f)
2) a should not be equal to zero.
3) d should not be equal to zero.
4) e should be less than 500.
Input consists of two test cases, each test case has two lines, first line contains the value of n and the second line consists of n numbers separated by space.
Output the total number of such tuples modulo (10^9 + 7).
There will be two test cases.
For the first test case :-
For the second test case :-
Input: 2 2 3 2 -1 1 Output: 4 24
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, 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.