Hangzhou Electric HDU ACM 1587 Flowers

Source: Internet
Author: User

Flowers Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 3066 Accepted Submission (s): 2052


Problem Descriptionas you know, Gardon Trid hard for him love-letter, and now he's spending too much time on choosing flow ERs for Angel.
When Gardon entered the flower shop, he is frightened and dazed by thousands kinds of flowers.
"How can I choose!" Gardon shouted out.
Finally, gardon--a NO-EQ man decided to buy flowers as many as possible.
Can compute how many flowers Gardon can buy at the most?
Inputinput has serveral test cases. Each case has a lines.
The first line contains, integers:n and M. means how much money Gardon has.
N integers following, means the prices of differnt flowers.
Outputfor each case, print how many flowers Gardon can buy at the most.
Firmly assume the number of each kind of flower is enough.
Sample Input
2 52 3

Sample Output
2HintHintgardon can buy 5=2+3,at most 2 flower, but he cannot buy 3 flower with 5 yuan.

Authordygg
SOURCE is so simple! Ya's balls.
#include <iostream>using namespace Std;int main () {int N,m,ls[1000];while (cin>>n>>m) {for (int i=0;i <n;i++) cin>>ls[i];int min=10000000;for (int j=0;j<n;j++) if (ls[j]<min) min=ls[j];cout<<m/min <<endl;} return 0;}

Hangzhou Electric HDU ACM 1587 Flowers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.