DCP-332: Egg, Banana and Bread Back to All Problems

Medium Beginners Problems > Ad-hoc


Many of us prefer to eat egg, banana, and bread as breakfast. **Kauser** has gone to market to bring these items. Problem is that he only has **T** taka in his pocket. He wants to utilize as much his money as possible to bring breakfast such that **the amount of Bread he buys should be greater than amount of Banana he buys and the amount of Banana he buys should be greater than amount of Egg he buys**.The amount of Egg, Banana and Bread must be **at least one**. The price of one egg costs **X** taka, the price of one banana costs **Y** taka and the price of one bread costs **Z** taka. Market price is so much expensive that **you will not get anything else less than 10 taka**. Your task is to help Kauser to utilize as much money as possible and tell him the minimum money he will save in his pocket after buying breakfast. If he can not buy breakfast maintaining above strategy print **-1**. Input: ------ Input starts with an integer **TC (1<=TC<=10)**, denoting the number of test cases. Each case begins with a line containing 3 integers say **X,Y,Z**. Then, there will be next line containg single integer value **T**. Output: ------- For each case of input, output a value as described in the problem statement. Constraints: ------- **10<=X,Y,Z<=1000** **1<=T<=1000** Sample Input ------------ 1 65 95 51 900 Sample Output ------------- 3


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats

76/224

Solve/Submission

Ranking

# User Language Timing
01 kissu_pari_na Cpp14 0.00s
02 ZERO Cpp14 0.00s
03 ovis96 Cpp14 0.00s
04 Pure_Protea Cpp14 0.00s
05 SbrTa Cpp14 0.00s
06 Rajan_sust Cpp14 0.00s
07 shamimjucse Cpp14 0.00s
08 ____ Cpp14 0.00s
09 Dark_Ocean Cpp14 0.00s
10 hrOarr Cpp14 0.00s
11 faceless_void Cpp14 0.00s
12 saiful130104 Cpp14 0.00s
13 MRITuhin Cpp14 0.00s
14 rayhan50001 Cpp14 0.00s
15 badhansen123 Cpp14 0.00s
16 Masum_ice Cpp14 0.00s
17 zyyxxx Cpp14 0.00s
18 _c_k_r_ Cpp14 0.00s
19 nurshuvo51 Cpp14 0.00s
20 SakibAlamin Cpp14 0.00s
21 Islam_Rafat Cpp14 0.00s
22 Brokenlog Cpp14 0.00s
23 Ishraq_Nibir Cpp14 0.00s
24 KAMO1 Cpp14 0.00s
25 ifat_just Cpp14 0.00s
26 priojeet_priyom Cpp14 0.00s
27 feodorv Cpp14 0.00s
28 Optimus_primeV2 Cpp14 0.00s
29 drifter Cpp 0.00s
30 anik_JU Cpp14 0.00s
31 subhashis_cse Cpp 0.00s
32 AlaminJust Cpp14 0.00s
33 njrafi Cpp14 0.00s
34 haasib Cpp14 0.00s
35 Chayti_Saha98 Cpp14 0.00s
36 pulak_ict_mbstu Cpp14 0.00s
37 Jisancse Cpp 0.00s
38 Morass Cpp14 0.00s
39 Bruteforcekid Cpp 0.00s
40 daihan_mbstu Cpp14 0.00s
41 tariqiitju Cpp14 0.00s
42 Sarwar05 Cpp 0.00s
43 Faizul_BU Cpp14 0.01s
44 mh755628 Cpp14 0.01s
45 emrul Cpp 0.01s
46 sazal_dev Cpp14 0.01s
47 nazmul49 Cpp14 0.01s
48 rajdipsaha Cpp 0.01s
49 yakin Cpp14 0.01s
50 alif_biswas Cpp14 0.01s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support