Tripartite String SOLUTIONS CMX1P02

Tripartite String SOLUTIONS CMX1P02

The String Family brought forth another Tripartite trio sisters and named them Hema, Rekha and Sushma. Hema and Rekha are exceptionally enamored with parties while Sushma detests them. One day Hema and Rekha requested that their folks get them confections to disseminate to individuals in their birthday celebration. (Recollect Hema, Rekha and Sushma were conceived around the same time). However, Sushma was uninterested in the gathering and just needed confections for herself. 

You will be given elite P of conceivable number of up-and-comers going to the gathering. Were P[i] indicates the include of individuals coming in the I th probability. For each situation each individual should get greatest conceivable equivalent number of confections with the end goal that in the wake of appropriating the confections, there are consistently R confections staying for Sushma. You need to figure the base number of confections needed to purchase so that, in any conceivable circumstance of the given exhibit, every individual coming to party gets equivalent number of confections (in any event 1 and greatest conceivable out of aggregate) and there are consistently R confections staying for Sushma. 



First line will contain T, number of testcases. At that point the testcases follow. 

First line of each experiment contain N, number of conceivable check of individuals coming to party 

Next line contain N divided whole numbers indicating the check of individuals 

Next line contain R the quantity of confections continually staying after most extreme equivalent appropriation 



For each testcase, yield in a solitary line answer, the base number of confections needed to purchase. 








Test Input: 

2 3 


Test Output: 




March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

one + 14 =