ural 1017. Staircases
http://acm.timus.ru/problem.aspx?space=1&num=1017
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 600
using namespace std; __int64 dp[maxn][maxn]; int main()
{
int n;
scanf("%d",&n);
memset(dp,,sizeof(dp));
dp[][]=;
for(int i=; i<=n; i++)
{
for(int j=; j<=i; j++)
dp[i][j]=dp[i-][j-]+dp[i-j][j-];
}
__int64 sum=;
for(int i=; i!=n; i++) sum+=dp[n][i];
printf("%I64d\n",sum);
return ;
}
ural 1017. Staircases的更多相关文章
- 递推DP URAL 1017 Staircases
题目传送门 /* 题意:给n块砖头,问能组成多少个楼梯,楼梯至少两层,且每层至少一块砖头,层与层之间数目不能相等! 递推DP:dp[i][j] 表示总共i块砖头,最后一列的砖头数是j块的方案数 状态转 ...
- ural 1017. Staircases(dp)
http://acm.timus.ru/problem.aspx?space=1&num=1017 题意:有n块砖,要求按照严格递增的个数摆放成楼梯,求楼梯的摆放种类数. 思路:状态转移方程: ...
- URAL DP第一发
列表: URAL 1225 Flags URAL 1009 K-based Numbers URAL 1119 Metro URAL 1146 Maximum Sum URAL 1203 Scient ...
- URAL题解一
URAL题解一 URAL 1002 题目描述:一种记住手机号的方法就是将字母与数字对应,如图.这样就可以只记住一些单词,而不用记住数字.给出一个数字串和n个单词,用最少的单词数来代替数字串,输出对应的 ...
- HUST 1017 - Exact cover (Dancing Links 模板题)
1017 - Exact cover 时间限制:15秒 内存限制:128兆 自定评测 5584 次提交 2975 次通过 题目描述 There is an N*M matrix with only 0 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
随机推荐
- SpringMVC、Zookeeper、Dubbo使用
联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,Dubbo是一个分布式服务框架,在这种情况下诞生的.现在核心业务抽取出来,作为独立的服务,使前 ...
- FFT修正
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #inc ...
- iOS项目更新之升级Xcode7 & iOS9
金田 前言 Apple 的WWDC所发布内容在给大家带来惊喜之际,给各位iOS开发的同仁却也带来了不同程度的麻烦.首先不讲新功能,就单指原来老版本的项目升级.代码升级,就是一堆问题,而且是不 ...
- 【转】[教程]隐藏ActionBar中的MenuItem
原文网址:http://blog.csdn.net/appte/article/details/12104823 有时候我们需要在不同的时候改变ActionBar中MenuItem的项数,或者隐藏某些 ...
- Android动画效果
layout_left_in.xml <?xml version="1.0" encoding="utf-8"?> <layoutAnimat ...
- GF(2^8)乘法
最近在学AES,实现了一下伽罗瓦域(2^8)乘法. 至于什么是伽罗瓦域解释起来比较复杂,我也不一定能解释清楚,自行google.这里只是给出一个简单直观的实现. #include<iostrea ...
- IE浏览器开启对JavaScript脚本的支持
在IE浏览器的"工具"菜单中选择"internet选项",在弹出命令对话框中选择"安全"选项卡.在该选项卡下的"该区域的安全级别& ...
- [React] React Router: Querystring Parameters
Define query param in Link, accept path and query : const Links = () => <nav > <Link to= ...
- [React] React Router: hashHistory vs browserHistory
In this lesson we'll look at hashHistory which uses a hash hack to track our route changes vs browse ...
- HDU 5067-Harry And Dig Machine(DFS)
Harry And Dig Machine Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...