hdu 1587 Flowers

Flowers

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

Problem Description

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?

Input

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.

Output

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.

Sample Input

2 5

2 3

Sample Output

2

 1 #include <iostream>
 2 using namespace std;
 3
 4 int main(){
 5     int n, m, num;
 6     while(cin >> n >> m){
 7         int min = 1000;
 8         for(int i = 0; i < n; i++){
 9             cin >> num;
10             if(num < min)
11                 min = num;
12         }
13         cout << m / min << endl;
14     }
15     return 0;
16 }
时间: 2024-10-25 17:28:09

hdu 1587 Flowers的相关文章

HDOJ(HDU) 1587 Flowers(水、、)

Problem Description 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 choos

HDU 1587 Flowers【贪心】

题意:给出n种花的价钱,和总的金额m,问最多能够买到多少朵花.先排序,然后就是便宜的花在能够买的范围内能够多买就多买 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[10010]; int main() { int n,m,i,ans,r; while(scanf("%d %d",&am

杭电 HDU ACM 1587 Flowers

Flowers Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3066    Accepted Submission(s): 2052 Problem Description As you know, Gardon trid hard for his love-letter, and now he's spending too muc

hdu 4325 Flowers(区间离散化)

http://acm.hdu.edu.cn/showproblem.php?pid=4325 Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2633    Accepted Submission(s): 1290 Problem Description As is known to all, the blooming t

HDU 4325 Flowers(树状数组)

Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3150    Accepted Submission(s): 1549 Problem Description As is known to all, the blooming time and duration varies between different kinds

集训手册贪心题练习题

HDU1009: 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 5 #define N 1005 6 7 struct Room{ 8 int j,f; 9 bool operator<(const Room &m)const{ 10 double rate1 = j*1.0/f; 11 double rate2 = m.j*1.0/m.f; 12 return rate1>

(线段树 区间运算求点)Flowers -- hdu -- 4325

http://acm.hdu.edu.cn/showproblem.php?pid=4325 Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2577    Accepted Submission(s): 1263 Problem Description As is known to all, the blooming t

hdu 4614 Vases and Flowers

http://acm.hdu.edu.cn/showproblem.php?pid=4614 题意:有N个花瓶,标号为0-N-1,往每一个花瓶放一朵花,然后有M个操作,输入a,b,c,如果a==1表示从b开始放花,期间有花就跳过,直到结束,如果没有放入一朵花,则输出“Can not put any one.”,否则输入第一朵花放的位置和最后一朵花放的位置. 如果a==2 则输出拔掉的花的朵数. 1 #include <cstdio> 2 #include <cstring> 3 #

HDU Flowers 完全背包

Flowers Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2709    Accepted Submission(s): 1811 Problem Description As you know, Gardon trid hard for his love-letter, and now he's spending too much