- 1、本文档共23页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
背包问题、LIS及LCS
poj 1837 Balance (01背包变形)
分类:?DP(动态规划)2014-05-20 15:56?134人阅读?评论(0)?收藏?编辑?删除
Balance
Time Limit:?1000MS ? Memory Limit:?30000K Total Submissions:?10065 ? Accepted:?6231 Description
Gigel has a strange balance and he wants to poise it. Actually, the device is different from any other ordinary balance.?It orders two arms of negligible weight and each arms length is 15. Some hooks are attached to these arms and Gigel wants to hang up some weights from his collection of G weights (1 = G = 20) knowing that these weights have distinct values in the range 1..25. Gigel may droop any weight of any hook but he is forced to use all the weights.?Finally, Gigel managed to balance the device using the experience he gained at the National Olympiad in Informatics. Now he would like to know in how many ways the device can be balanced.?Knowing the repartition of the hooks and the set of the weights write a program that calculates the number of possibilities to balance the device.?It is guaranteed that will exist at least one solution for each test case at the evaluation.?
Input
The input has the following structure:?? the first line contains the number C (2 = C = 20) and the number G (2 = G = 20);?? the next line contains C integer numbers (these numbers are also distinct and sorted in ascending order) in the range -15..15 representing the repartition of the hooks; each number represents the position relative to the center of the balance on the X axis (when no weights are attached the device is balanced and lined up to the X axis; the absolute value of the distances represents the distance between the hook and the balance center and the sign of the numbers determines the arm of the balance to which the hook is attached: - for the left arm and + for the right arm);?? on the next line there are G natural, distinct and sorted in ascending order numbers in the range 1..25 representing the weights values.?
Output
The output contains the number M representing the number of possib
您可能关注的文档
- 译林版七年级预备篇Starter Lesson 1 Nice to meet you.doc
- Python下Pandas的14个最佳特色功能.docx
- C++使用OTL连接数据库.doc
- MENU NEW YEAR DAY LUNCH 新年午餐菜单.doc
- 新视野听说教程教案第一课.doc
- APS 专业审核考试 公共经济学.docx
- Syllabus_for宏观经济PATHWAY.doc
- 2012《经济学人》重点词汇.doc
- AP micro- & macroeconomics重点.doc
- proe色值.docx
- 2025年山东省郯城县全国中考统一考试模拟试题(二)生物试题含解析.doc
- 湖南省娄底市达标名校2025届初三第三次联考生物试题文试题含解析.doc
- 吉林省长春市第29中学2025届初三4月生物试题含解析.doc
- 江西省景德镇市2025届初三(下)月考生物试题试卷(五)(4月份)含解析.doc
- 福建省龙岩市上杭县2025届初三下第一次摸底考试生物试题含解析.doc
- 2025届重庆江南新区达标名校初三下学期期末考试(一模)生物试题含解析.doc
- 江西省上饶县七中重点达标名校2025届初三零诊考试生物试题含解析.doc
- 湖南省衡阳市衡阳县2024-2025学年高中毕业班第一次模拟考试生物试题试卷含解析.doc
- 2025年湖南省长沙市芙蓉区第十六中学初三下学期暑假联考生物试题含解析.doc
- 江苏省泰州市靖江实验学校2024-2025学年初三年级生物试题月考试卷含解析.doc
文档评论(0)