Ural 1081. Binary Lexicographic Sequence
来源:互联网 发布:mac下载flash插件 编辑:程序博客网 时间:2024/05/16 11:33
递推。
首先,计算满足条件的N位序列的总个数。设为f[n]
f[n]=f[n-1]+f[n-2]
可是这样理解:长度为N的序列对应于:
1.长度为N-1的序列左边加上0
2.长度为N-2的序列左边加上10
之后就类似求排列序号的方法。
要明白以下这个事实:
N位序列 0,a2,...an 必然在 N位序列 1,a2,..an 之前。
而 0,a2,..an 序列数对应于f[n-1]
若K大于f[n-1]则说明第一位为1,问题转化为求N-1位序列的第 K-f[n-1] 个是什么
若K小于等于f[n-1]则说明第一位为0,问题转化为求N-1位序列的第K个是什么
- Ural 1081. Binary Lexicographic Sequence
- ural 1081. Binary Lexicographic Sequence
- Ural 1081. Binary Lexicographic Sequence
- URAL 1081. Binary Lexicographic Sequence(简单dp)
- ural 1081 Binary Lexicographic Sequence
- Ural 1081 Binary Lexicographic Sequence
- timus 1081. Binary Lexicographic Sequence URAL 解题报告
- ural Binary Lexicographic Sequence (dp + dfs)
- Ural 1081 Binary Lexicographic Sequence(DP)
- Timus 1081. Binary Lexicographic Sequence
- 1081. Binary Lexicographic Sequence(dp)
- URAL 1081 Binary Lexicographic Sequence (递推 + 递归)
- Binary Lexicographic Sequence
- Binary Lexicographic Sequence_简单DP
- ural 1306. Sequence Median
- ural 1306. Sequence Median
- Ural 1306. Sequence Median
- URAL 1306. Sequence Median
- UPS的使用和计算
- android:gravity和android:layout_gravity区别
- 《高质量C/C++编程指南》笔记
- flex 旋转字体/旋转位图/字体以指定旋转中心旋转/定时器的简单用法
- C#读取Word表格数据
- Ural 1081. Binary Lexicographic Sequence
- Thinking in Java笔记2
- C语言算法100例(转)
- C语言算法100例(转)
- 活动与任务
- sqlserver 2008 连接问题
- 在浏览器的搜索栏增加搜索项
- Fedora64安装官方QQ的方法
- Java在编写文件下载的代码中如何避免文件名乱码情况