HDU 1070 Milk(水~)

水题 hdu 1070 milk http://acm.hdu.edu.cn/showproblem.php?pid=1070 #include /* 读题不慎,WA了一次 */ int main() { char name[101][100]; int t,n,i,k=0; int a[101],b[101],bb[111]; scanf("%d",&t); while(t--) 阅读详情

Description
土豪要买牛奶,对牛奶的要求是生产日期5天内饮用,每天喝200ml,少于200ml或者过期的扔掉,商场牛奶均是当天生产,选取满足要求的单价最小的牛奶,当单价一样时选择容量多的
Input
第一行为用例组数T,每组用例第一行输入牛奶种数n,之后n行每行为一种牛奶的描述,包括牛奶的名称,价格和价钱
Output
对于每组用例,输出土豪要买哪种牛奶
Sample Input
2
2
Yili 10 500
Mengniu 20 1000
4
Yili 10 500
Mengniu 20 1000
Guangming 1 199
Yanpai 40 10000
Sample Output
Mengniu
Mengniu
Solution
对于低于200ml的牛奶,将其单位价钱定成INF,对于超过1000ml的牛奶,将其单位价钱定成其价钱/5,对于低于1000ml的牛奶,将其单位价钱定成其价钱/(容量/200)),然后对每种牛奶先按价钱降序排序,价钱相同则按容积升序排序之后输出第一项即可
Code

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 111111111
struct node
{
    char s[111];
    double pr;
    int v;
}m[111];
int cmp(node a,node b)
{
    if(a.pr!=b.pr)//价钱不同则将价钱降序排 
        return a.pr<b.pr;
    return a.v>b.v;//价钱相同则按容量降序排 
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            int temp,pri;
            scanf("%s%d%d",m[i].s,&pri,&temp);
            m[i].v=temp;
            if(temp<200)//容量小于200价钱定成INF 
                m[i].pr=INF;
            else if(temp>1000)//容量超过1000也只能喝5天 
                m[i].pr=pri*1.0/5;
            else//容量低于1000则可以喝temp/200天 
                m[i].pr=pri*1.0/(temp/200);
        }
        sort(m,m+n,cmp);//对牛奶排序 
        puts(m[0].s);
    }
    return 0;
}
郑州大学信息内容安全2021期末考试题 sudo root报错,应改为su root 压缩命令,tar -zxvf 文件 阅读详情

相关推荐

十一、机器学习进阶知识:径向基神经网络(RBFNN)的实现(Python,附源码及数据集)

本文对径向基神经网络(RBFNN)的理论基础及建模步骤进行介绍,之后使用Python实现基于RBFNN的数据预测,通俗易懂,适合新手学习,附源码及实验数据集。

weixin_42051846的博客 1万+

hdu1070 Milk

#include #include int main() {     int T,N,i,j,P[105],V[105],p,D;     double kase[105];     char st[105][105];     scanf("%d",&T);     while(T--)     {         scanf("%d",&N);        

Iguodala的博客 460

别再手动算LLC了!用Mathcad 15分钟搞定谐振参数与增益曲线(附已验证产品案例)

本文详细介绍了如何利用Mathcad在15分钟内高效完成LLC谐振变换器的参数计算与增益曲线绘制。通过对比传统工具,突出Mathcad在自然数学表达、实时单位换算和动态参数关联方面的独特优势,帮助电源工程师大幅提升设计效率。文章还提供了已验证的产品案例和实用模板,助力工程师快速掌握谐振参数优化技巧。

weixin_42548888的博客 554

HDU1068——Girls and Boys,HDU1069——Monkey and Banana,HDU1070——Milk

【代码】HDU1068——Girls and Boys,HDU1069——Monkey and Banana,HDU1070——Milk。

u014114223的博客 7420

Matplotlib图片尺寸调整全攻略:从figsize到savefig的实战技巧

在数据可视化与科学计算中,图形尺寸控制是影响图表可读性与专业度的基础环节。其核心原理在于协调逻辑尺寸(英寸)与物理输出(像素)的映射关系,这直接决定了信息呈现的清晰度与布局合理性。从技术价值看,精准的尺寸控制能提升图表在不同媒介(如学术论文、报告、网页)中的适配性,避免显示不全、模糊失真等常见问题。在应用场景上,无论是Jupyter Notebook中的交互探索、自动化报告的批量生成,还是满足严格出版要求的插图制作,都需要掌握对应的尺寸调整策略。本文聚焦于matplotlib中的figsize参数、rcPa

weixin_30899023的博客 345

本地AI代码助手:智能解析大型代码库,实现自动化重构与理解

在软件开发中,大型代码库的理解与维护是常见挑战。传统方法依赖人工阅读和有限上下文工具,效率低下。通过结合检索增强生成(RAG)和多智能体(Multi-Agent)架构,现代AI工具能够智能解析代码结构,理解模块关系,并精准定位相关代码片段。这种技术不仅能提升代码探索效率,还能自动化执行重构、文档生成等任务,在遗留系统维护、快速上手新项目等场景中发挥关键作用。本文以blackboxaicode/cli为例,展示了如何利用其代码感知和Workflow Automation能力,高效处理复杂代码库。

weixin_30240349的博客 380

hdu 1070 Milk

hdu  1070  Milk                    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 贪心水 题目大意:Ignatius喝牛奶,给出一些牛奶的参数,从中选出性价比最高的牛奶。 题目分析:给出的参数有品名、容量、价格。由于一天要喝200ml,不够的扔掉,所以总量不足200ml的可以忽略不计。以5天为期,过期

slicer的技术交流栈 938

LLC谐振变换器软启动,不只是“慢启动”,还是“智能启动”

LLC谐振变换器的软启动,不只是“慢慢来”,而是要在控制时序、限流、响应速度之间精妙权衡。而数字控制,特别是用查表法或混合信号法,为实现真正的“最佳轨迹”提供了可能。✨小Tips:如果你的系统成本敏感,选择查表法准没错;如果你的设计目标是超高速响应,那就上混合信号的高配方案!

weixin_43199439的博客 702

hdu 1070 Milk(水)

http://acm.hdu.edu.cn/showproblem.php?pid=1070 /* 2011-9-9 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream

580

华为OD机试2025C卷 - CPU调度策略 (C++ & Python & JAVA & JS & GO)

华为OD机试 2025C卷 CPU调度策略,提供Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解

qq_45776114的博客 1304

零承诺的启动之路:详解 SAP BTP 的 Pay-As-You-Go for SAP BTP(含案例与迁移策略)

SAP BTP的Pay-As-You-Go(PAYG)模式为零承诺的按需付费方案,适合PoC和小规模上线场景。它提供生产环境直接启用服务的能力,按月后付标准目录价,无预付和折扣。PAYG可与BTP企业协议(BTPEA/CPEA)混合使用,用量稳定后可平滑迁移至CPEA获取更好财务条款。关键优势在于灵活开启/关闭服务,支持通过SAP Discovery Center估算费用,并配合成本治理工具控制支出。该模式适用于创新项目初期,当业务规模可预测时再考虑转为承诺型消费模式。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 261

HDU1070 Milk【水题】

MilkTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25696    Accepted Submission(s): 6966Problem DescriptionIgnatius drinks milk everyday, now h...

海岛Blog 881

基于FISCO BCOS 部署可升级的 Solidity存证智能合约

本文介绍了基于FISCOBCOS平台的可升级Solidity存证智能合约实现方案。采用透明代理模式,包含逻辑合约、代理合约和管理合约三部分,支持业务逻辑升级而不影响存储数据。详细阐述了合约架构设计、Solidity代码实现、Go SDK交互流程以及完整的部署升级步骤。方案具有数据持久性、版本兼容性和生产就绪等特点,提供了权限控制、输入验证等安全机制,并包含监控管理工具。该实现为企业级区块链存证应用提供了可靠的基础架构,支持后续功能扩展和定制化开发。

分享AI、区块链技术及应用,未来已来 1526

Milk HDU - 1070

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 写这篇博客的就是为了吐槽一下题目描述的坑。题目原文是这样描述的Ignatius will never drink the milk which is produced 6 days ago or earlier. That means if the milk is produced 2005-...

成龙大侠的博客 213

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Hdu 1070 Milk【水】

Milk Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17820 Accepted Submission(s): 4597 Problem Description Ignatius drinks milk eve

希望的专栏 1345

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

HDU1070 Milk 细节决定成败

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 注意:1.喝到第五天,第六天就不喝了 2.相同花费的,优先考虑容量大的 3.注意强制类型转换 4.精度一定要注意 附上题解:    #include <cstdio> #include <cstring> #include <iostream...

weixin_30432179的博客 161

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

【让我悲催的水题】HDU 1070 Milk

[url]http://acm.hdu.edu.cn/showproblem.php?pid=1070[/url] [size=medium]题意: ①:milk最多只能喝5天 ②:每天喝200ml ③:如果剩下的小于200ml,就要扔掉 ④:所有milk都是今天生产的 ⑤:当有多个milk一样便宜时,选择体积最大的 给出商标+1瓶的价格+体积,找出最便宜的那种milk 错...

基德KID.1412 134

HDU 1070 Milk(水题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 Milk Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10484Accepted Submission(s): 2497...

weixin_30321709的博客 93

HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU

MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址:  http://acm.hdu.edu.cn/showproblem.php?pid=1070题目描述:MilkTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submis...

weixin_30836759的博客 143

hdu1070Milk

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 水。 代码: #include #include #include using namespace std; struct Node{ char s[105]; int price; int v; double perPrice;

奋斗的Die Young 439

HDU1070:Milk

Problem Description Ignatius drinks milk everyday, now he is in the supermarket and he wants to choose a bottle of milk. There are many kinds of milk in the supermarket, so Ignatius wants to know whi

ACM!荣耀之路! 2869

hd 1070 Milk

http://acm.hdu.edu.cn/showproblem.php?pid=1070 #include #include #include using namespace std; struct milk{ char name[1000]; double money,ml; double val; int day; }m[105];

本博停更 新博客:bugnull.com 797

hdu 1070 Milk

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070   import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); int N=inpu

繁华过后你还有我 880

HDU1070:Milk

点击打开题目链接 Milk Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10366    Accepted Submission(s): 2460 Problem Description

I just want to AC you~~~ 2067

hdu 1070Milk

地址链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 题意:多看几遍,学着静下来心去看英文题 代码: #include<bits/stdc++.h> using namespace std; struct p { char s[200]; int money; int v; i...

weixin_30709929的博客 82

HDU 1070 Milk

Problem Description Ignatius drinks milk everyday, now he is in the supermarket and he wants to choose a bottle of milk. There are many kinds of milk in the supermarket, so Ignatius wants to know whi

老鼠 821
上一篇: HDU 1062 Text Reverse(水~)
下一篇: HDU 1071 The area(计算几何)
v5zsq
博客等级 码龄11年 501粉丝 2436原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值