DCP-560: Game Show II Back to All Problems

Easy Math > Counting


Rahim is attending in a game. In this game he has to pick up N number of same color balls among some distinct colors of balls from a box blindly. The colors are red, blue, green and yellow. In that box there are respectively R, B, G and Y numbers of red, blue, green and yellow color balls. Input: ------ Input starts with an integer **T ( 1<=T<=10 )**, denoting the number of test cases.<br> Each case contains two lines of input. First line will contain four integers **R , B, G** and **Y ( 2 ≤ R, B, G, Y ≤ 10^9 )** denoting respectively the number of red, blue, green and yellow color balls. The next line will contain an integer **N ( 1 ≤ N ≤ min (R ,B, G, Y) )** denoting the number of same color balls which Rahim has to find out blindly. Output: ------- For each case of input, output will be an integer number representing the minimum number of balls Rahim has to pick up from the box blindly to ensure that **N** balls of same color. Sample Input ------------ 1 10 10 10 10 4 Sample Output ------------- 13


Problem Setter:

MD. ISHTIAQ ISLAM

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

138/352

Solve/Submission

Ranking

# User Language Timing
01 asad_IT Cpp 0.00s
02 emrul Cpp 0.00s
03 muhaimin Cpp 0.00s
04 FahimSifnatul Cpp 0.00s
05 tariqiitju Cpp 0.00s
06 kashem1993 Cpp 0.00s
07 Masum_ice Cpp 0.00s
08 Pure_Protea Cpp14 0.00s
09 _Lucifer Cpp14 0.00s
10 Arpan_cse_2k14 Cpp 0.00s
11 ssavi Cpp 0.00s
12 skmonir Cpp14 0.00s
13 subhashis_cse Cpp 0.00s
14 loop_breaker Cpp 0.00s
15 Ihtiaz Cpp 0.00s
16 m_arif Cpp 0.00s
17 wizard Cpp 0.00s
18 Hasinur_ Cpp 0.00s
19 fayedanik Cpp 0.00s
20 motaleb_ICT Cpp 0.00s
21 Reayz Cpp14 0.00s
22 jahidwarrior Cpp 0.00s
23 pulak_ict_mbstu Cpp 0.00s
24 ashraful_afruz Cpp 0.00s
25 feodorv C 0.00s
26 hamza133913 Cpp 0.00s
27 Chayti_Saha98 Cpp 0.00s
28 Ahb_arif Cpp 0.00s
29 Mhkhaled Cpp 0.00s
30 shahed95 Cpp 0.00s
31 ivax6 Cpp14 0.00s
32 Bappy Cpp 0.00s
33 DynamicOvi Cpp 0.00s
34 aaman007 Cpp 0.00s
35 Maruf_Robin Cpp 0.00s
36 zubayerhossain Cpp 0.00s
37 ashikur_rahman Cpp 0.00s
38 Ratul728 Cpp 0.00s
39 Mahadi_Hasan Cpp 0.00s
40 sumaiya710 Cpp 0.00s
41 tashfiq_ahm Cpp 0.00s
42 Chucks Cpp14 0.00s
43 monir_18 Cpp 0.00s
44 hmsayem Cpp14 0.00s
45 Rabia Cpp 0.00s
46 daihan_mbstu Cpp 0.00s
47 TarikulCSE Cpp14 0.00s
48 Tufahel Cpp 0.00s
49 wajiul Cpp 0.00s
50 Faisal_Al_Mamun Cpp 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support