The Chef and the Triangles
All submissions for this problem are available.
The chef is fond of triangles. He has a task for you. You are given n point out of which only k are collinear. Find the number of triangles that can be formed from these n points.
You have to perform the above task for a number of test cases.
The first line of input contains the number of test cases, t.
Then t lines follow each containing 2 space separated integers n and k.
The output contains t lines each containing the answer for that particular test case.
Each line contains the number triangles that can be formed for that particular test.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, 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, CLOJ, FS|
Fetching successful submissions