All submissions for this problem are available.
Chef invented a new game, which involve three players.There are 'N' players who want to play these game,but in a game only three can play at a time.
Selection of these three players is done in very interesting way i.e. chef will provide us a no 'C', now we need to select three players in such way that the sum of their ages will be greater than 'C'.
Chef wants to find out the no of ways in which these selections can be made.
First line of input contains 't' the the no of testcases.
First line of each testcase contains the no of participants.
Second line of each testcase contains array of size 'N' where A[i] represents the age of the player ith player.
Third line contains the no. 'C'.
Single line of output contains the no of possible ways in which selection can be done.
1 <= T <= 10
2 < N <= 100
1 <= T <= 10
2 < N <= 5000
1 < A[i] < 1012
Input: 1 10 5 4 6 9 3 7 2 8 1 10 23 Output: 7
Example case 1. There are 7 ways in which selection can be made. 1.(5,9,10) 2.(6,9,10) 3.(9,7,10) 4.(9,8,10) 5.(7,8,10) 6.(10,6,8) 7.(9,7,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, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions