博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDOJ(HDU) 1587 Flowers(水、、)
阅读量:6548 次
发布时间:2019-06-24

本文共 1325 字,大约阅读时间需要 4 分钟。

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

HintHint

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

大概题意:

输入m n
再输入m种花的价格
就是你有n元钱,需要买最多的花,问最多能买多少朵花!
一种花你可以买很多朵!!!
所以,只要找到最低价格的花就可以了。

import java.util.Scanner;public class Main{    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        while(sc.hasNext()){            int a = sc.nextInt();            int b = sc.nextInt();            int min = sc.nextInt();            a--;            int t;            while(a-->0){                t = sc.nextInt();                if(t

转载地址:http://rtgdo.baihongyu.com/

你可能感兴趣的文章
spring mvc+mybatis整合cms内容发布平台
查看>>
vsftpd服务简介
查看>>
Maven 入门之单元测试
查看>>
MySql学习笔记(八):explain之extra
查看>>
一、Linux应用程序基础 1、应用程序与系统命令的关系 文件位置 主要用途...
查看>>
职场必备!学会这4个技巧,便可轻松操作Excel!
查看>>
红米手机3S 3X获取ROOT权限的经验
查看>>
年度必读:2018最具突破性人工智能论文Top 10
查看>>
如何操作PDF内容编辑
查看>>
.net开源工作流引擎ccflow表单数据返回值Pop分组模式和表格模式对比
查看>>
邮件安全与社会工程学
查看>>
Cheese : A tool to use your camera
查看>>
安装类问题
查看>>
js 查找文章中的关键字,并标红
查看>>
Java面试题-基础篇五
查看>>
死磕 java集合之TreeMap源码分析(四)-内含彩蛋
查看>>
华为路由器简单配置默认路由
查看>>
Tcp/IP详解
查看>>
是什么让我流眼泪
查看>>
linux系统下集成开发工具选择
查看>>