Problem Description
If two people were born one after another with one second difference and one of them is a child,
then the other one is a child too. We get by induction that all the people are children.
Everyone knows that the mathematical department of the Ural State University is a big family of N persons, 1, 2, 3, …, N years old respectively.
Once
the dean of the department ordered a photo if his big family. There
were to be present all the students of the department arranged in one
row. At first the dean wanted to arrange them by their age starting from
the youngest student, but than he decided that it would look unnatural.
Than he advised to arrange the students as follows:
  1. The 1 year old student is to sit at the left end of the row.
  2. The difference in ages of every two neighbors mustn’t exceed 2 years.
The dean decided that thereby the students would seem
look as they were arranged by their ages (one can hardly see the
difference in ages of 25 and 27 years old people). There exist several
arrangements satisfying to the requirements. Photographer didn’t want to
thwart dean’s desire and made the photos of all the possible
mathematical department students’ arrangements.
 
Input
There is the integer number N, 1 ≤ N ≤ 55.
Output
the number of photos made by the photographer.
 
Sample Input
input output
4
4

Hint

If N = 4 then there are following possible arrangements: (1,2,3,4), (1,2,4,3), (1,3,2,4) and (1,3,4,2).
 
#include <stdio.h>

typedef __int64 LL;

int main(){
LL a[];
a[]=;
a[]=;
a[]=;
a[]=;
for(int i=; i<=; i++){
a[i]=a[i-]+a[i-]+;
}
int n;
while( scanf("%d",&n)!=EOF ){
printf("%I64d\n",a[n]);
}
return ;
}
 

Ural 1260 Nudnik Photographer的更多相关文章

  1. 递推DP URAL 1260 Nudnik Photographer

    题目传送门 /* 递推DP: dp[i] 表示放i的方案数,最后累加前n-2的数字的方案数 */ #include <cstdio> #include <algorithm> ...

  2. URAL 1260 Nudnik Photographer(递推)

    题目链接 题意 : 给你1到n这n个数,排成一排,然后1放在左边最开始,剩下的数进行排列,要求排列出来的数列必须满足任何两个相邻的数之间的差不能超过2,问你有多少种排列 思路 : 对于dp[n], n ...

  3. URAL 1260 Nudnik Photographer DFS DP

    题目:click here :这个题可以先dfs深搜下,规律dp dfs: #include <bits/stdc++.h> using namespace std; #define S ...

  4. Ural 1260 A nudnik photographer(DP)

    A nudnik photographer 大意: 对1到N这些数进行排列,1必需要在最左边.相邻的两个数之间的差值不能超过2,问有多少种排列的方法. 思路: 对座位进行DP,当第一个是1,第二个是2 ...

  5. Nudnik Photographer -Ural1260动态规划

    Time limit: 1.0 second Memory limit: 64 MB If two people were born one after another with one second ...

  6. URAL DP第一发

    列表: URAL 1225 Flags URAL 1009 K-based Numbers URAL 1119 Metro URAL 1146 Maximum Sum URAL 1203 Scient ...

  7. URAL(DP集)

    这几天扫了一下URAL上面简单的DP 第一题 简单递推 1225. Flags #include <iostream> #include<cstdio> #include< ...

  8. 【DP】HDU 1260

    HDU 1260 Tickets 题意:有N个人要买票,你可以一个一个人卖票,时间分别为Xs,也可以相邻两个人一起卖票,时间为Ys,从早上八点开始卖票,问你何时最早将N个人的票卖完. 思路:解决情况是 ...

  9. [BZOJ 1260][CQOI2007]染色(DP)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1260 分析: f[i][j]表示i~j刷成s[i]~s[j]这个样子需要的最小次数 则 ...

随机推荐

  1. C# Excel 操作

    Excel数据到datagridview 里面 (流读取) System.Windows.Forms.OpenFileDialog fd = new OpenFileDialog(); if (fd. ...

  2. ZeroSSL,支持多域名的在线 Let's Encrypt SSL 证书申请工具

    前言: 微信需要ssl证书,很多网站都有免费一年的证书:免费一年的证书叫做单域名证书,iis没办法配置多个子站点443端口:我有很多客户需要用我的的域名,同一个域名配置多个ssl,或者支持多个子域名: ...

  3. 关于 href="\\#" 和 return false

    href="\\#"  跳转到本页 return false 相当于不刷新 href="javascript:void(0)"   或者 href=" ...

  4. select chosen 的入门使用

    首先要引用 因为肯定要引用jq,所以就没有写啦 <link rel="stylesheet" href="__ROOT__/Public/jschy/chosen_ ...

  5. 【spring boot】FilterRegistrationBean介绍

    前言 以往的javaee配置过滤器是在web.xml中配置的,如下代码 <filter> <filter-name>TestFilter</filter-name> ...

  6. linux下用rpm 安装jdk

    转载自http://blog.csdn.net/ldl22847/article/details/7605650 1.下载jdk的rpm安装包,这里以jdk-7u4-linux-i586.rpm为例进 ...

  7. Java create azure web app

    create a certificate <java-install-dir>/bin/ keytool -genkey -alias <keystore-id> -keyst ...

  8. python3入门之字符串

    获得更多资料欢迎进入我的网站或者 csdn或者博客园 经过前面的介绍相信大家也对python有了一个初步的了解:本节主要介绍字符串,不管学习什么编语言字符串一定在其中扮演着重要的地位.本节主要讲解,字 ...

  9. java基础_01

    一.java中的数据类型 1.基本数据类型:四类八种 byte(1),boolean(1),short(2),char(2),int(4),float(4),long(8),double(8); 2. ...

  10. jenkins-APP打包页面展示二维码【转】

    背景: 客户要求在APP打包页面展示二维码.虽然感觉这个功能很鸡肋,但是还是加上吧. 效果展示: 配置: 在上图中,106对应的内容是BuildName,我们可以通过build-name-setter ...