当前位置:网站首页>2546 饭卡(01背包,挺好的)
2546 饭卡(01背包,挺好的)
2022-08-04 13:14:00 【51CTO】
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2546
思路:刚开始直接把背包的容量搞为m-5+max1(max1的值为最贵的菜的价格),因为他最多的能花这么多,结果错了,应该把最大的单独提出来,用5块来买,剩下的钱做背包
AC代码:
错误代码:(这个会造成价值最大的有可能没有选,逻辑不对)
边栏推荐
猜你喜欢

Is the code more messy?That's because you don't use Chain of Responsibility!

Interviewer: Tell me the difference between NIO and BIO

LeetCode_424_替换后的最长重复字符

持续交付(三)Jenkinsfile语法使用介绍

双目立体视觉学习笔记(一)

Access Huawei game anti-addiction, click the anti-addiction pop-up window, the game crashes

RK1126编译gdb 板子上gdb调试程序
![[Niu Ke brush questions-SQL big factory interview questions] NO5. Analysis of a treasure store (e-commerce model)](/img/9f/33e782b93fcaa15359450e59a7233d.png)
[Niu Ke brush questions-SQL big factory interview questions] NO5. Analysis of a treasure store (e-commerce model)

“蔚来杯“2022牛客暑期多校训练营5 B、C、F、G、H、K

Do you understand the various configurations in the project?
随机推荐
LeetCode 1403 非递增顺序的最小子序列[贪心] HERODING的LeetCode之路
Install mysql on k8s
Niuke.com Brush Question Record || Linked List
关于mysql join 的一些说明
使用COLMAP初步三维重建
"Lonely Walking on the Moon" is a powerful medicine, it can't cure the internal friction of happy twist
MogDB/openGauss 3.0 扩容及缩容
03 多线程与高并发 - ReentrantLock 源码解析
持续交付(二)PipeLine基本使用
从零开始配置 vim(7)——自动命令
Billboard
Two years of independent development experience Programmers tell us the experience of making money (listen to the masters who really make money)
秋招攻略秘籍,吃透25个技术栈Offer拿到手软
高手,云集在于REST、gRPC 和 GraphQL之间!
Control CD-ROM with VbScript
用过Apifox这个API接口工具后,确实感觉postman有点鸡肋......
leetcode 48. Rotate Image 旋转图像(Medium)
Motion Rule (16)-Union Check Basic Questions-Grid Game
为什么密码云服务平台是云时代的必然之选?
router---Route guard