01串
时间限制:1000 ms | 内存限制:65535 KB 难度:2- 描述
-
ACM的zyc在研究01串,他知道某一01串的长度,但他想知道不含有“11”子串的这种长度的01串共有多少个,他希望你能帮帮他。
注:01串的长度为2时,有3种:00,01,10。
- 输入
-
第一行有一个整数n(0
随后有n行,每行有一个整数m(2<=m<=40),表示01串的长度; - 输出
- 输出不含有“11”子串的这种长度的01串共有多少个,占一行。
- 样例输入
-
2 2 3
- 样例输出
-
3 5
01.#include02.usingnamespacestd;03.intmain()04.{05.intnum[41][2],i;06.num[2][0]=2;//长为2,结尾为007.num[2][1]=1;//长为2,结尾为108.for(i=3;i<41;i++)09.{10.num[i][0]=num[i-1][1]+num[i-1][0];11.num[i][1]=num[i-1][0];12.}13.intn,m;14.cin>>n;15.while(n--)16.{17.intm;18.cin>>m;19.cout<20.}21.return0;22.}
<script type="text/java script">- <script type="text/java script">BAIDU_CLB_fillSlot("771048");
- 点击复制链接 与好友分享! 回本站首页 <script> function copyToClipBoard(){ var clipBoardContent=document.title + '\r\n' + document.location; clipBoardContent+='\r\n'; window.clipboardData.setData("Text",clipBoardContent); alert("恭喜您!复制成功"); }
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; - 您对本文章有什么意见或着疑问吗?请到 论坛讨论您的关注和建议是我们前行的参考和动力??
-
上一篇:
HDU 1254 推箱子
-
下一篇:
杭电 2063 过山车
-
相关文章
-
<script type="text/java script">BAIDU_CLB_fillSlot("182716");
-
<script type="text/java script">BAIDU_CLB_fillSlot("517916");
-
图文推荐
<script>
(function(){
var appid = 'cyrBEfE7C',
conf = 'prod_830794cf494da8b808afb2994cfe0fee';
var doc = document,
s = doc.createElement('script'),
h = doc.getElementsByTagName('head')[0] || doc.head || doc.documentElement;
s.type = 'text/java script';
s.charset = 'utf-8';
s.src = 'http://assets.changyan.sohu.com/upload/changyan.js?conf='+ conf +'&appid=' + appid;
h.insertBefore(s,h.firstChild);
window.SCS_NO_IFRAME = true;
})()
-
<script type="text/java script">BAIDU_CLB_fillSlot("771057");



