Ural 1260 Nudnik Photographer
then the other one is a child too. We get by induction that all the people are children.
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:
- The 1 year old student is to sit at the left end of the row.
- The difference in ages of every two neighbors mustn’t exceed 2 years.
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 | output |
---|---|
4 |
4 |
Hint
#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的更多相关文章
- 递推DP URAL 1260 Nudnik Photographer
题目传送门 /* 递推DP: dp[i] 表示放i的方案数,最后累加前n-2的数字的方案数 */ #include <cstdio> #include <algorithm> ...
- URAL 1260 Nudnik Photographer(递推)
题目链接 题意 : 给你1到n这n个数,排成一排,然后1放在左边最开始,剩下的数进行排列,要求排列出来的数列必须满足任何两个相邻的数之间的差不能超过2,问你有多少种排列 思路 : 对于dp[n], n ...
- URAL 1260 Nudnik Photographer DFS DP
题目:click here :这个题可以先dfs深搜下,规律dp dfs: #include <bits/stdc++.h> using namespace std; #define S ...
- Ural 1260 A nudnik photographer(DP)
A nudnik photographer 大意: 对1到N这些数进行排列,1必需要在最左边.相邻的两个数之间的差值不能超过2,问有多少种排列的方法. 思路: 对座位进行DP,当第一个是1,第二个是2 ...
- Nudnik Photographer -Ural1260动态规划
Time limit: 1.0 second Memory limit: 64 MB If two people were born one after another with one second ...
- URAL DP第一发
列表: URAL 1225 Flags URAL 1009 K-based Numbers URAL 1119 Metro URAL 1146 Maximum Sum URAL 1203 Scient ...
- URAL(DP集)
这几天扫了一下URAL上面简单的DP 第一题 简单递推 1225. Flags #include <iostream> #include<cstdio> #include< ...
- 【DP】HDU 1260
HDU 1260 Tickets 题意:有N个人要买票,你可以一个一个人卖票,时间分别为Xs,也可以相邻两个人一起卖票,时间为Ys,从早上八点开始卖票,问你何时最早将N个人的票卖完. 思路:解决情况是 ...
- [BZOJ 1260][CQOI2007]染色(DP)
题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1260 分析: f[i][j]表示i~j刷成s[i]~s[j]这个样子需要的最小次数 则 ...
随机推荐
- c#读取数据库内容
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 【SQL】- 基础知识梳理(五) - 触发器
触发器的概念 触发器对表进行插入.更新.删除的时候会自动执行的特殊存储过程 触发器的语法 create trigger tgr_name on table_name with encrypion –加 ...
- SQL语句也可以重构优化
真的,不管是程序中的代码可以重构优化,在SQL Server的语句,也是可以的.下面举个例子,在存储过程中,所传入的数据参数不能为空,另外在对数据表进行更新时,所更新的字段如果是空的话,就更新,如果传 ...
- loj#6041. 「雅礼集训 2017 Day7」事情的相似度(后缀自动机+启发式合并)
题面 传送门 题解 为什么成天有人想搞些大新闻 这里写的是\(yyb\)巨巨说的启发式合并的做法(虽然\(LCT\)的做法不知道比它快到哪里去了--) 建出\(SAM\),那么两个前缀的最长公共后缀就 ...
- yum及RPM安装
yum及RPM安装 基本说明: 1.yum相当于windows上面的360软件中心 2.yum是redhat系列发行版的软件安装命令 debian系统用的是apt-get 3.yum安装软件的来源得存 ...
- ssh免密码登录、secureCRT免密码登录详解
再放一张真机实现图: 接下来就详细讲述实现细节. 实现过程中吃了不少苦头,这个不对,那个不通.好在慢慢一点点摸索出来了,经验分享在这里. 希望能终结网上ssh免密码登录,以及SecureCRT免密码登 ...
- The server of Apache (二)——apache服务客户端验证
一.确定网站名称.IP地址 地址为: 192.168.1.1 域名为: www.benet.com 二.配置可用的DNS域名服务或者修改本地hosts记录 ~] # vim /etc/hosts ...
- [USACO10MAR]伟大的奶牛聚集 BZOJ 1827 树形dp+dfs
题目描述 Bessie is planning the annual Great Cow Gathering for cows all across the country and, of cours ...
- 网址访问量统计插件 FlagCounter
网址或博客访问量统计插件 ---> FlagCounter. 网址:http://s01.flagcounter.com/more/ERP2/
- SQL语句之表操作
SQL语句系列 1.SQL语句之行操作 2.SQL语句之表操作 3.SQL语句之数据库操作 4.SQL语句之用户管理 写在前面 在上一篇博文里面我整理了“行”级别的操作,分别是“增(insert).删 ...