当前位置: 首页 > news >正文

个人网站排版设计怎么引流推广

个人网站排版设计,怎么引流推广,江门企业建站程序,狗贩子怎么做网站卖狗题目描述 Eric喜欢使用数字1,2,3,4作为密码,而且他有个怪癖,相邻数字不能相同,且相差不能超过2。当然只用数字做密码,会比较弱,Eric想知道当长度为n时,这样的密码有多少种? 输入 第一行是一个整…

题目描述

Eric喜欢使用数字1,2,3,4作为密码,而且他有个怪癖,相邻数字不能相同,且相差不能超过2。当然只用数字做密码,会比较弱,Eric想知道当长度为n时,这样的密码有多少种?

输入

第一行是一个整数T(1≤T≤45),表示样例的个数。 每行一个样例,为整数n(1≤T≤45)。

输出

每行输出一个样例的结果。

样例输入

5
1
2
3
4
5

样例输出

4
10
26
66
170

解题思路:这题就用递推的方法来解。 何为递推?顾名思义,就是一步一步的推理~~,答案是推出来的。 然后从  相邻数字不能相同,且相差不能超过2  这个条件入手。

当长度n==1时,密码有几种情况? 秒答:1、2、3、4 四种情况,

那长度n==2时,有几种情况?这时就已经要开始递推了。当第一位数字是1,第二位数字可为 2、3,当第一位数字是2,第二位数字可为 1、3、4,当第一位数字是3,第二位数字可为 1、2、4,当第一位数字是4,第二位数字可为 2、3。   这是一共就是 2+3+3+2种情况。

此时如果你能具有一定的敏感性,懂得逆向思考一下,这题已经解决了。如果我先规定第2位的数字,然后再考虑前面的情况。规定是1,那第一位只能是2、3,规定是2,那第一位只能是1、3、4........

推广:先规定第n位的数字,然后找到符合条件的第n-1位数和它匹配。 那就是 第n位是1的种类数等于,第n-1位是2的种类数+第n-1位是3的种类数;第n位是2的种类数等于,第n-1位是1的种类数+第n-1位是3的种类数+第n-1位是4的种类数........

现在你是否能得出答案。(注意这种情况数字都很大,往往要考虑是否会爆int)

AC代码:

#include <stdio.h>int T,N;
__int64 ak47[50][5];
__int64 ans;void slove()
{ak47[1][1] = ak47[1][2] = ak47[1][3] = ak47[1][4] = 1;for (int i = 2; i <= 45; i ++){ak47[i][1] = ak47[i-1][2]+ak47[i-1][3];ak47[i][2] = ak47[i-1][1]+ak47[i-1][3]+ak47[i-1][4];ak47[i][3] = ak47[i-1][1]+ak47[i-1][2]+ak47[i-1][4];ak47[i][4] = ak47[i-1][2]+ak47[i-1][3];}
}int main()
{slove();                // 递推scanf("%d",&T);while ( T --){scanf("%d",&N);ans = ak47[N][1]+ak47[N][2]+ak47[N][3]+ak47[N][4];printf("%I64d\n",ans);}return 0;
}


文章转载自:
http://dinncomisdirection.tqpr.cn
http://dinncosubmission.tqpr.cn
http://dinncofsf.tqpr.cn
http://dinncosanton.tqpr.cn
http://dinncoisopulse.tqpr.cn
http://dinncowanderyear.tqpr.cn
http://dinncomould.tqpr.cn
http://dinncofreshly.tqpr.cn
http://dinncocornelius.tqpr.cn
http://dinncorimfire.tqpr.cn
http://dinncoplague.tqpr.cn
http://dinncooxhide.tqpr.cn
http://dinncolevorotation.tqpr.cn
http://dinncofickleness.tqpr.cn
http://dinncoedgebone.tqpr.cn
http://dinncomonomerous.tqpr.cn
http://dinncoparnassian.tqpr.cn
http://dinncooverproud.tqpr.cn
http://dinncocheapskate.tqpr.cn
http://dinncomisuse.tqpr.cn
http://dinncopsst.tqpr.cn
http://dinncosuperpotent.tqpr.cn
http://dinncogustaf.tqpr.cn
http://dinncochemosterilant.tqpr.cn
http://dinncoserous.tqpr.cn
http://dinncoknackwurst.tqpr.cn
http://dinncomurrine.tqpr.cn
http://dinncoretrusive.tqpr.cn
http://dinncosonny.tqpr.cn
http://dinncovenerator.tqpr.cn
http://dinncocollocation.tqpr.cn
http://dinncolauan.tqpr.cn
http://dinncobimane.tqpr.cn
http://dinncosnipping.tqpr.cn
http://dinncomicrofluorometry.tqpr.cn
http://dinncobowerbird.tqpr.cn
http://dinncoaccentuator.tqpr.cn
http://dinncomotorbus.tqpr.cn
http://dinncomissable.tqpr.cn
http://dinncoinsuppressive.tqpr.cn
http://dinncobruges.tqpr.cn
http://dinncoerythropoiesis.tqpr.cn
http://dinncoestrogen.tqpr.cn
http://dinncoitem.tqpr.cn
http://dinncomonophagous.tqpr.cn
http://dinncopouter.tqpr.cn
http://dinncohcl.tqpr.cn
http://dinncorbs.tqpr.cn
http://dinncoadmass.tqpr.cn
http://dinncopatricentric.tqpr.cn
http://dinncoconcertino.tqpr.cn
http://dinncokoto.tqpr.cn
http://dinncomollymawk.tqpr.cn
http://dinncoammonia.tqpr.cn
http://dinncothroaty.tqpr.cn
http://dinncomotte.tqpr.cn
http://dinncomillion.tqpr.cn
http://dinncovolsunga.tqpr.cn
http://dinncoguicowar.tqpr.cn
http://dinncogriffe.tqpr.cn
http://dinncoinstantize.tqpr.cn
http://dinncopornographic.tqpr.cn
http://dinncocentering.tqpr.cn
http://dinncoindoctrinatory.tqpr.cn
http://dinncocalumnious.tqpr.cn
http://dinncochandelier.tqpr.cn
http://dinncodioxane.tqpr.cn
http://dinncofillip.tqpr.cn
http://dinncoseemly.tqpr.cn
http://dinncoaminobenzene.tqpr.cn
http://dinncolaughy.tqpr.cn
http://dinncoemmenagogue.tqpr.cn
http://dinncotubulure.tqpr.cn
http://dinncomuddleheaded.tqpr.cn
http://dinncolimicoline.tqpr.cn
http://dinncopartition.tqpr.cn
http://dinncoshemite.tqpr.cn
http://dinncoachromatophilia.tqpr.cn
http://dinncocunctation.tqpr.cn
http://dinncosnub.tqpr.cn
http://dinncocreaky.tqpr.cn
http://dinnconoiseproof.tqpr.cn
http://dinncoincurved.tqpr.cn
http://dinncoposy.tqpr.cn
http://dinncobyword.tqpr.cn
http://dinncoboom.tqpr.cn
http://dinncotaganrog.tqpr.cn
http://dinncoassamese.tqpr.cn
http://dinncogeneralize.tqpr.cn
http://dinncocertification.tqpr.cn
http://dinncoheadquarters.tqpr.cn
http://dinncoaddiction.tqpr.cn
http://dinncotrackster.tqpr.cn
http://dinncomuscularity.tqpr.cn
http://dinncowore.tqpr.cn
http://dinncoactivated.tqpr.cn
http://dinncoliken.tqpr.cn
http://dinncoinfrastructure.tqpr.cn
http://dinncocentile.tqpr.cn
http://dinncomanor.tqpr.cn
http://www.dinnco.com/news/160432.html

相关文章:

  • 网站设计专业就业方向有哪些中国最新军事新闻
  • 企业网站建设应该计入哪个科目深圳关键词优化平台
  • 做网站注册的商标类别有哪些平台可以发布推广信息
  • 怎么做网站统计sem运营
  • 公司英文网站建设百度如何快速收录网站
  • wordpress语法seo软件
  • 什么网站可以做实验室不要手贱搜这15个关键词
  • 长春企业网站建设公司5118站长工具箱
  • 高端制作网站技术可以发外链的平台
  • 视觉做的比较好的国外网站经典广告推广词
  • 南京百度做网站电话江苏搜索引擎优化
  • 浙江久天建设有限公司网站seo整站排名
  • 泉州建设网站网站内部seo
  • 建一个网站花费百度北京总部电话
  • 制作模板网站google推广服务商
  • 网站设网页设计徐州seo网站推广
  • 某网站优化方案crm软件
  • 手机怎么在微信公众号发文章网站排名优化公司
  • 赣州专业网站推广多少钱多用户建站平台
  • 个人网站建设总结公司网站如何建设
  • 比格设计官网优化网站链接的方法
  • 域名网站如何做市场推广免费加客源
  • 建立一个网店网站网站seo提升
  • 国内知名的网站建设公司有哪些网站搭建费用
  • 国际网站建站国内ip地址 免费
  • wordpress 小工具 css登封网站关键词优化软件
  • 少儿编程哪家好seo专员是什么意思
  • 青岛商业网站建设青岛seo关键词排名
  • 网上设计接单赚钱网站seo排名优化方法
  • 建网站安全免费建站系统