2012年4月3日

hdu 3001 状态压缩

摘要: 转载:http://hi.baidu.com/the_one1989/blog/item/002aeb862327be83f603a618.htmlhttp://acm.hdu.edu.cn/showproblem.php?pid=3001 很经典的TSP问题,但是题目又有改变,每个旅游地可以走两遍,故进行扩展2状态的状态压缩DP伸展为3状态的状态压缩问题。0表示没去过此点,1 表示去过一次,2表示去过两次,状态转移方程基本和以前一样dp[i][j]=min(dp[i][k]+map[k][j]),状态压缩表示要稍微耐心 点。附上代码#include"iostream"#i 阅读全文

posted @ 2012-04-03 17:05 Goal 阅读(349) 评论(0) 推荐(0) 编辑

dp Sum of Digits

摘要: Sum of DigitsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 181Accepted Submission(s): 53Problem DescriptionPetka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched 阅读全文

posted @ 2012-04-03 17:03 Goal 阅读(226) 评论(0) 推荐(0) 编辑

导航