Codeforces Round #272 (Div. 1)D(字符串DP)
2 seconds
512 megabytes
standard input
standard output
Dreamoon saw a large integer x written on the ground and wants to print its binary form out. Dreamoon has accomplished the part of turning x into
its binary format. Now he is going to print it in the following manner.
He has an integer n = 0 and can only perform the following two operations in any order for unlimited times each:
- Print n in binary form without leading zeros, each print will append to the right of previous prints.
- Increase n by 1.
Let's define an ideal sequence as a sequence of operations that can successfully print binary representation of x without
leading zeros and ends with a print operation (i.e. operation 1). Dreamoon wants to know how many different ideal sequences are there and the length (in operations) of the shortest ideal sequence.
The answers might be large so please print them modulo 1000000007 (109 + 7).
Let's define the string representation of an ideal sequence as a string of '1' and '2' where
the i-th character in the string matches thei-th
operation performed. Two ideal sequences are called different if their string representations are different.
The single line of the input contains a binary integer representing x (1 ≤ x < 25000)
without leading zeros.
The first line of the output should contain an integer representing the number of different ideal sequences modulo 1000000007 (109 + 7).
The second line of the output contains an integer representing the minimal length of an ideal sequence modulo 1000000007 (109 + 7).
101
1
6
11010
3
5
For the first sample, the shortest and the only ideal sequence is «222221» of length 6.
For the second sample, there are three ideal sequences «21211», «212222222221»,
«222222222222222222222222221». Among them the shortest one has length 5.
Codeforces Round #272 (Div. 1)D(字符串DP)的更多相关文章
- Codeforces Round #272 (Div. 2) 题解
Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per ...
- Codeforces Round #272 (Div. 1)C(字符串DP)
C. Dreamoon and Strings time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #272 (Div. 2) B. Dreamoon and WiFi dp
B. Dreamoon and WiFi 题目连接: http://www.codeforces.com/contest/476/problem/B Description Dreamoon is s ...
- Codeforces Round #272 (Div. 2) E. Dreamoon and Strings dp
题目链接: http://www.codeforces.com/contest/476/problem/E E. Dreamoon and Strings time limit per test 1 ...
- Codeforces Round #272 (Div. 2) E. Dreamoon and Strings 动态规划
E. Dreamoon and Strings 题目连接: http://www.codeforces.com/contest/476/problem/E Description Dreamoon h ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- Codeforces Round #131 (Div. 1) B. Numbers dp
题目链接: http://codeforces.com/problemset/problem/213/B B. Numbers time limit per test 2 secondsmemory ...
- Codeforces Round #131 (Div. 2) B. Hometask dp
题目链接: http://codeforces.com/problemset/problem/214/B Hometask time limit per test:2 secondsmemory li ...
- Codeforces Round #276 (Div. 1) D. Kindergarten dp
D. Kindergarten Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/proble ...
随机推荐
- top 查看资源使用
top:动态观察程序的变化 ? [root@linux ~]# top [-d] | top [-bnp] 参数: -d :后面可以接秒数,就是整个程序画面更新的秒数.预设是 5 秒: -b :以批次 ...
- Eclipse正确导入第三方project
前言 昨晚,在不同的Android做出最终的在线测试时间,在其他平台上正常升级的提示突然报告出来"java.lang.NoClassDefFoundError"误.拉什adb lo ...
- ssh否password登陆server
在线辅导课非常多,但仍录,使用时方便日后查询. 两server,内联网ip每间: 172.16.3.91 (本地计算机) 172.16.3.92 (远程机) 现在想在本地计算机上通过ssh 172.1 ...
- Lua 服务器与客户端实例(转)
=============================================================== 服务器,main.lua ======================= ...
- 【C语言的日常实践(十四)】constkeyword详细解释
const是C语言keyword,它定义一个变量不同意变更.使用const在一定程度上,可以提高节目的安全性和可靠性.其他.解const的作用,在看别人的代码时,对理解对方的程序有一定帮助. 1.co ...
- Codeforces Round #270(利用prim算法)
D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 mega ...
- ORACLE profile列4 --CREATE PROFILE
这个博客是ORACLE profile系列第四部分.主要说一下,假设你创建profile而使用profile资源和password控制 CREATE PROFILE Note: Oracle reco ...
- 获取Winform窗体、工作区 宽度、高度、命名空间、菜单栏高度等收集
MessageBox.Show("当前窗体标题栏高"+(this.Height - this.ClientRectangle.Height).ToString());//当前窗体标 ...
- implements KeyListener但关键监听器监听少
今天写的游戏.主要听众,但它并不总是加入了育雏, 我实现了接口,但不听 后来,我发现只是没想到服用口服细致怎么称呼控制panel上面增加了一个addKeyListener(this); 基础不坚固.马 ...
- Memcahce(MC)系列(三)Memcached它PHP转让
由PHP转让Memcahce,首先,需要在server安装Memcache,如何安装Memcache这不是本文的重点, 大约memcache安装,谁的朋友有兴趣,请参阅这里:http://blog.c ...