Sereja and ASum
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Sereja have an array that consist of n integers a, a, ..., a[n]. Now Sereja want to delete some(possible none, but not all) elements from the array, such that arithmetical mean of all remaining numbers will as big as possible.
Help Sereja, find number of ways to delete numbers.
First line contain integer T - number of testcases. T tests follow. First line of each testcase contain integer n. Next line contain n integers a, a, ..., a[n].
For each testcase print the answer modulo 10^9+7.
Input: 2 1 1 4 1 2 1 2 Output: 1 3
Test #0-1(25 points) n ≤ 20
Test #2(25 points) n ≤ 1000
Test #3-4(50 points) n ≤ 100000
|Tags||cakewalk, implementation, ltime09, maths, sereja|
|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, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.