Java Hackathon

Market :Today is Sunday and Disha is out for the shopping. She has reached to the famous market of the city. She has a list of items which she wants to buy but she has a very low amount of cash today and no shop accepts any online payment method in the market. Disha has only D rupees with her and wants to buy N items (she wants to buy as many units of item as possible). She wants to shop in a way such that first she buy 1 quantity of all the items she wants to buy and then she will move to buy 2nd quantity of any item.

Can you help her by calculating how many items she can buy today if she shops optimally?

You are given an array which represents the price of items Disha wants to buy.

Example :-

If she wants to buy 4 items having price 4, 6, 2, 5 respectively and has 49 rupees only then she will buy in this order:- 1st item, 2nd item, 3rd item, 4th item (It will cost 17 rupees). Again she will buy in this order 1st, 2nd, 3rd, 4th (it will cost 17 rupees). Now, she has remaining 15 rupees so she can buy any 3 items.

Input Format

The first line of input consists of two space-separated integers, N (number of items Disha wants to buy) and D (amount of cash Disha has with her).

The second line of input consists of N space-separated integers which represents the price of the N items Disha wants to buy.


1<= N <=1e9

1<= Ni <=10^15 (1e15)

1<= D <=10^18 (1e18)

Output Format

Print the count of items which Disha can buy.

Example : 5,24


Compétences : Java, Architecture Logicielle, JavaScript, PHP, Développement de logiciel

En voir plus : java super market project, best prenatal vitamins market today, java stock market karachi, europ market today, market today bangalore, program java etpro market, total stock market today, java stock market program, java yahoo market tracker, java project market related, android java game market, java stock market analysis, easy java project completed today urgent requirement, java project market, java stock market project, article writers in the market today, market research on shopping trolley tracking device in australia, today sunday, stock market today, wall street stock market today

Concernant l'employeur :
( 0 commentaires ) Mumbai, India

Nº du projet : #30500568

1 freelance fait une offre moyenne de ₹1500 pour ce travail


I can solve it. Hello, I have good knowledge of OOP and data structure and algorithms. I have solved 300+ ACM problems. I have programming expertise on C, C++, Java, Python. I have coding test experience on hackerra Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% INR en 1 jour
(41 Commentaires)