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]这个样子需要的最小次数 则 ...
随机推荐
- Linux 命令之chmod
立贴今日吉,不断更新,欢迎斧正,支持为感! 1. chmod --权限控制 chmod [-cfvR] [--help] [--version] mode file... 说明 : Linux/Uni ...
- C#上位机中ZedGraph控件的使用
上位机程序控制PLC模拟量通道输出周期性正弦波信号,并采集所造成改变的模拟量输入信号,并绘制数据变化曲线. 界面如图: 最后测试效果如图: 代码: using System; using System ...
- 安卓开发时访问google方法
启动浏览器后15秒左右,浏览器的右上角就会出现图标 启用防火墙功能(右上角墙形图标),这时候程序就会去寻找网上代理,从而达到访问GOOGLE的效果,提示如果不访问google网站,可再点击一下关闭防火 ...
- linux 建议锁和强制锁
作为APUE 14.3节的参考 linux是有强制锁的,但是默认不开启.想让linux支持强制性锁,不但在mount的时候需要加上-o mand,而且对要加锁的文件也需要设置相关权限. . ...
- Kotlin 函数
至于什么函数,在计算机里面就是一个密闭的执行程序的代码块(个人理解) 我们先来看看什么是函数 fun main(agrs : Array<String>) { println(" ...
- Delphi XE8如何同Eclipse使用相同的Android SDK?
我的Android SDK是单独安装的:Eclipse也是最新版的,并不是谷歌提供的集成了SDK的那个Eclipse:Delphi XE8安装后,我并没有通过XE8里面下载Android SDK到XE ...
- 第二篇 Python运算符
1.算术运算符 运算符 描述 + 两个值相加 - 两个值相减 * 两个值相乘 / 两个值相除 % 得到两个数相除的余数 ** x**y得到x的y次幂 // 返回两个数相除商 ...
- 题解 P4140 【奇数国 】
题目链接 首先,按照题意,把前$60$个素数打出来$[2$ $-$ $281]$. 因为只有$60$个,再加上本宝宝极其懒得写线性筛于是每一个都$O(\sqrt{n})$暴力筛就好了. 代码如下: # ...
- Java面向对象之内部类(匿名内部类)
一.基础概念 匿名内部类:简化书写的内部类.其实匿名内部类就是一个子类对象. 前提:内部类需要继承或者实现外部的类或者接口. 格式:new 父类或者接口(){定义子类的内容} 二.将内部类定义到局部的 ...
- 线性可分SVM完全推导过程