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. DataGridView移动上下行

    /// <summary> /// 移动行 /// </summary> /// <param name="i_UpFlag">移动标识,tru ...

  2. linux联网配置(更新)

    重启网络配置:service network restart: 常见问题: linux 虚拟机ifconfig 显示eth1 文件ifcfg-eth0中device为eth0的问题   为什么eth0 ...

  3. Educational Codeforces Round 62 (Rated for Div. 2)E(染色DP,构造,思维,组合数学)

    #include<bits/stdc++.h>using namespace std;const long long mod=998244353;long long f[200007][2 ...

  4. 数据结构之BF算法,kmp算法,三元组,十字链表总结

    在这一章中,老师教了我们四种数据结构:BF算法,kmp算法,三元组和十字链表:还给我们讲了2019年团体天体赛中T1-8的AI题 1.对于BF和kmp算法,老师除了在课堂上讲解算法的主要核心思想外,还 ...

  5. 在一个java类里,private int a; 什么时候要使用integer

    private Integer index; if(index == null) index = 0; else this.index = index; Integer有一个明显的好处,就是它能比in ...

  6. C# Winform下一个热插拔的MIS/MRP/ERP框架(多语言方案)

    个别时候,我们需要一种多语种切换方案. 我的方案是这样的: 1.使用文本文本存储多语言元素,应用程序启动时加载到内存表中: 2.应用程序启动时从配置文件加载语种定义: 3.所有窗体继承自一个Base基 ...

  7. 【noip2017】【Luogu3960】列队 线段树

    题目描述 Sylvia 是一个热爱学习的女♂孩子. 前段时间,Sylvia 参加了学校的军训.众所周知,军训的时候需要站方阵. Sylvia 所在的方阵中有 n \times mn×m 名学生,方阵的 ...

  8. 【ARC077F】SS kmp+打表找规律

    Description ​ 如果某个串可以由两个一样的串前后连接得到,我们就称之为"偶串".比如说"xyzxyz"和"aaaaaa"是偶串, ...

  9. Kafka,Mq,Redis作为消息队列有何差异?

    Kafka作为新一代的消息系统,mq是比较成熟消息系统,而redis也可以发布订阅,那么这三者有何异同? RabbitMQ 是使用Erlang编写的一个开源的消息队列,本身支持很多的协议:AMQP,X ...

  10. UX | 最小可行性技能

    简评:本文介绍了最小 UX 需要技能(可以看成设计版 MVP),包括用不同视角看事情,从回馈中学习等等 ~ 呐,可能刚入门设计的时候,会让一堆工具弄得眼花缭乱.其实呢,并不一定要每样都会使用,举一反三 ...