HDU 5366 The mook jong
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 5366 The mook jong相关的知识,希望对你有一定的参考价值。
Problem Description
ZJiaQ want to become a strong man, so he decided to play the mook jong。ZJiaQ want to put some mook jongs in his backyard. His backyard consist of n bricks that is 1*1,so it is 1*n。ZJiaQ want to put a mook jong in a brick. because of the hands of the mook jong, the distance of two mook jongs should be equal or more than 2 bricks. Now ZJiaQ want to know how many ways can ZJiaQ put mook jongs legally(at least one mook jong).
Input
There are multiply cases. For each case, there is a single integer n( 1 < = n < = 60)
Output
Print the ways in a single line for each case.
#include<stdio.h> #include<iostream> #include<algorithm> using namespace std; typedef long long LL; LL a[70]; LL ans[70]; int main(void) { int n; a[1]=1;a[2]=1;a[3]=1; ans[1]=1;ans[2]=2;ans[3]=3; LL sum=0; for (int i=4;i<=60;++i) { sum+=a[i-3]; a[i]=sum+1; ans[i]=ans[i-1]+a[i]; } while (scanf("%d",&n)!=EOF) { cout<<ans[n]<<endl; } }
以上是关于HDU 5366 The mook jong的主要内容,如果未能解决你的问题,请参考以下文章
HDU-1561 The more, The Better (树形DP+分组背包)
The service already exists! The current server installed: D:mysqlmysql-5.7.30-winx64inmysqld My(代码片
ASP.NET MVC 复制MVC项目代码到同一个项目的时候报错The request for ‘home’ has found the following matching controll(代码片
Warning: Permanently added the RSA host key for IP address ‘13.250.177.223‘ to the list of known(代码片