您的位置:首页 > 其它

hdu 1587 Flowers

2016-06-05 13:40 429 查看

Flowers

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3679 Accepted Submission(s): 2412

[align=left]Problem Description[/align]
As you know, Gardon trid hard for his love-letter, and now he's spending too much time on choosing flowers for Angel. When Gardon entered the flower shop, he was 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 you compute how many flowers Gardon can buy at most?

[align=left]Input[/align]
Input have serveral test cases. Each case has two lines. The first line contains two integers: N and M. M means how much money Gardon have. N integers following, means the prices of differnt flowers.

[align=left]Output[/align]
For each case, print how many flowers Gardon can buy at most. You may firmly assume the number of each kind of flower is enough.

[align=left]Sample Input[/align]

2 5
2 3

[align=left]Sample Output[/align]

2

#include <iostream>
using namespace std;

int main(){
int n, m, num;
while(cin >> n >> m){
int min = 1000;
for(int i = 0; i < n; i++){
cin >> num;
if(num < min)
min = num;
}
cout << m / min << endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: