登录
首页 » c++ » 回溯法求砝码称重问题

回溯法求砝码称重问题

于 2022-08-05 发布 文件大小:1.04 kB
0 44
下载积分: 2 下载次数: 1

代码说明:

编写c++代码。使用回溯法求解砝码称重问题,代码稍微修改也可用于求解0-1背包问题 问题描述:有n个砝码,现在要称一个质量为m的物体,请问最少需要挑出几个砝码来称?注意一个砝码最多只能挑一次 输入描述 Input Description:第一行两个整数n和m,接下来n行每行一个整数表示每个砝码的重量。 输出描述 Output Description:输出选择的砝码的总数k,你的程序必须使得k尽量的小。 样例输入 Sample Input 3 10 5 9 1 样例输出 Sample Output 2

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Pingtu
    说明:  Visual C++ 开发的拼图游戏,你可以下载下来学习,在vc6.0下能顺利运行(Visual C++ development jigsaw puzzle, you can download it and learn to run smoothly under the vc6.0)
    2011-03-05 13:26:44下载
    积分:1
  • aprorio代码c++实现
    APRORIO算法的C++实现,可以输出频繁k项集,并得到极大频繁项集。支持很大的数据库,运行速度较快,我用过的最大的数据库运行时间也就两秒。在devc++上可以运行,支持c89,c99编译器,有些代码必须c99编译器才行,但是这个c89也可以。
    2022-09-16 11:45:03下载
    积分:1
  • 风力摆003.1
    2015年全国大学生电子设计大赛-风力摆控制系统,(Wind Pendulum Control System in the National College Students Electronic Design Competition in 2015)
    2020-06-21 10:40:02下载
    积分:1
  • BoxMan
    CPP写个推箱子游戏。。。。。。。。。..............(CPP write a Sokoban game. . . . . . . . . ..............)
    2013-07-15 19:47:19下载
    积分:1
  • c语言简单的推箱子
    c语言简单的推箱子原理,输入方向键控制人物,人物前面如果有箱子,并且箱子在上,箱子前面是空,按完回车
    2023-04-08 13:25:03下载
    积分:1
  • ChiToLetter
    vc++将汉字转换成拼音的程序源代码,非常有意思,它不单纯转换为拼音,而且还可以设置分隔符,按规则转换:全部转换成大写、全部转换成小写、将首字母大写,还可以转换为现在流行的拼音首字母简写,也就是只取拼音首字母,按大写或小写提取,看来确实非常有意思也非常实用哦。(vc++ will be converted into Chinese characters spelling the source code, very interesting, it does not simply converted to Pinyin, but also can be set separators in accordance with the rules of conversion: the conversion of all upper case, all converted to lowercase to uppercase the first letter, but also can be converted to Pinyin is now the first letter of the popular shorthand, that is, only the first letter of alphabet, based on extraction of upper or lowercase, it seems very interesting indeed Oh also very practical.)
    2009-07-16 22:20:28下载
    积分:1
  • Hex2c
    Hex文件转换为 C 文件, 比较实用的一个小工具。(Convert HEX files to C files)
    2010-05-20 17:58:46下载
    积分:1
  • jumping_the_queue
    The beginning of a winter break near Spring Festival is always the beginning of a peak period of transportation. If you have ever tried to get a train ticket at that time, you must have witnessed the endless queues in front of every ticket box window. If a guy has seen his friend in a queue, then it is very much likely that this lucky guy might go straight to his friend and ask for a favor. This is called "jumping the queue". It is unfair to the rest of the people in the line, but, it is life. Your task is to write a program that simulates such a queue with people jumping in every now and then, assume that, if one in the queue has several friends asking for favors, he would arrange their requests in a queue of his own(The beginning of a winter break near Spring Festival is always the beginning of a peak perio d of transportation. If you have ever tried to ge not a train ticket at that time. you must have witnessed the endless queues in fr ont of every ticket box window. If a guy has seen h is friend in a queue, then it is very much likely that this lucky guy mi ght go straight to his friend and ask for a favor. This is called "jumping the queue." It is unfair to the rest of the people in the line, but, it is life. Your task is to write a program that si mulates such a queue with people jumping in ever y now and then, assume that, if one in the queue has several friends asking az r favors. he would arrange their requests in a queue of his own)
    2006-11-04 20:29:57下载
    积分:1
  • O__Reilly.Programming.Embedded.Systems
    Programming embebbed software from Oreylly
    2013-01-15 18:03:17下载
    积分:1
  • SEVER
    多人在线的网络聊天室—服务器,简化实用 可以修改后添加其他功能(Multiplayer online chat rooms- server, simplifying practical Other functions can be modified to add)
    2013-10-05 19:42:35下载
    积分:1
  • 696518资源总数
  • 104224会员总数
  • 54今日下载