All submissions for this problem are available.
A gang of K robbers have broken into a jewellery shop having N jewelleries at night and there is nobody to stop the robbery. The robbers are intelligent and have planned that after the robbery is complete they will run separately and then meet later some day with their corresponding jewellery to distribute the amount equally because if by chance anyone gets caught then the remaining robbers can still be safe. They decided that each one of them will carry exactly one jewellery. You are given the price of each jewellery in the shop. You have to tell the maximum amount that the robbers can steal.
First line will contain T, number of testcases. Then the testcases follow.
First line of each test case contains two integers N, K.
Second line has N space separated integers, where ith integer P(i) denotes the price of the ith jewellary
For each test case,print the maximum amount of jewellary they can steal.
- 1 ≤ T ≤ 100
- 1 ≤ K ≤ N ≤ 100000
- 1 ≤ P(i) ≤ 100000
Input: 2 5 3 2 12 11 7 10 10 2 4 9 2 3 8 40 29 3 6 5 Output: 33 69
|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, PYP3, CLOJ, COB, FS|
Fetching successful submissions