2010年12月7日

摘要: 本题就是让你输出N位的二进制数中不包含两个连续的1的个数DP瞬秒!!!关键是找到DP方程假设二进制序列为a1,a2,a3,........a(i-2),a(i-1),a(i)opt[i]表示i位二进制数中符合上述特性的数字个数则可得到opt[i]=opt[i-1]+opt[i-2]因为,如果a(i)为0,则,opt[i]=opt[i-1]如果a(i)为1,那么a(i-1)一定为0,则,opt[i]=opt[i-2]动态规划的题目关键就是找到合适的状态转移方程#include<stdio.h>int opt[50];int binary[10];void decimal_to_bin 阅读全文
posted @ 2010-12-07 15:22 yming0221 阅读(145) 评论(0) 推荐(0)
摘要: ArbitrageTime Limit:1000MSMemory Limit:65536KTotal Submissions:6340Accepted:2831DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British pound, 阅读全文
posted @ 2010-12-07 14:05 yming0221 阅读(122) 评论(0) 推荐(0)

导航