ural 1142. Relations
1142. Relations
Memory limit: 64 MB
Background
a < b
b < a
b = c < a a = c < b b < a = c a < b < c
a < c < b b < a < c b < c < a c < a < b
c < b < a
Problem
Input
Output
Sample
input | output |
---|---|
|
|
- /**
- Create By yzx - stupidboy
- */
- #include <cstdio>
- #include <cstring>
- #include <cstdlib>
- #include <cmath>
- #include <deque>
- #include <vector>
- #include <queue>
- #include <iostream>
- #include <algorithm>
- #include <map>
- #include <set>
- #include <ctime>
- #include <iomanip>
- using namespace std;
- typedef long long LL;
- typedef double DB;
- #define MIT (2147483647)
- #define INF (1000000001)
- #define MLL (1000000000000000001LL)
- #define sz(x) ((int) (x).size())
- #define clr(x, y) memset(x, y, sizeof(x))
- #define puf push_front
- #define pub push_back
- #define pof pop_front
- #define pob pop_back
- #define ft first
- #define sd second
- #define mk make_pair
- inline int Getint()
- {
- int Ret = ;
- char Ch = ' ';
- bool Flag = ;
- while(!(Ch >= '' && Ch <= ''))
- {
- if(Ch == '-') Flag ^= ;
- Ch = getchar();
- }
- while(Ch >= '' && Ch <= '')
- {
- Ret = Ret * + Ch - '';
- Ch = getchar();
- }
- return Flag ? -Ret : Ret;
- }
- const int N = ;
- int n;
- int dp[N][N], ans[N];
- inline void Init()
- {
- dp[][] = ;
- for(int i = ; i <= ; i++)
- for(int j = ; j <= i; j++)
- dp[i][j] = dp[i - ][j] * j + dp[i - ][j - ] * j;
- for(int i = ; i <= ; i++)
- for(int j = ; j <= i; j++)
- ans[i] += dp[i][j];
- }
- inline void Solve();
- inline void Input()
- {
- Init();
- while(scanf("%d", &n) == )
- {
- if(n == -) return;
- Solve();
- }
- }
- inline void Solve()
- {
- printf("%d\n", ans[n]);
- }
- int main()
- {
- freopen("a.in", "r", stdin);
- Input();
- //Solve();
- return ;
- }
ural 1142. Relations的更多相关文章
- URAL 1142——Relations——————【dp】
A - Relations Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submi ...
- Ural State University Internal Contest October'2000 Junior Session
POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7 ...
- mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES
AutoMySQLBackup备份时,出现mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@' ...
- 4.Rabbits and Recurrence Relations
Problem A sequence is an ordered collection of objects (usually numbers), which are allowed to repea ...
- BZOJ 1142: [POI2009]Tab
1142: [POI2009]Tab Time Limit: 40 Sec Memory Limit: 162 MBSubmit: 213 Solved: 80[Submit][Status][D ...
- 后缀数组 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 ...
随机推荐
- Git命令之从GitHub上下载开源项目
1,先在本地创建一个目录,作为本地仓库,如: 2,使用Git init 初始化仓库,git初始化完成后,会生成一个隐藏的git文件如: 3,clone Git项目,如: 4,这个项目就是合Github ...
- XMPP框架下微信项目总结(5)花名册获取(好友列表)
---->概念 ---->添加花名册 ps:添加花名册,启动: 客户端发送请求到服务器获取好友列表信息,同时在项目中创建数据表,并保存好友列表到数据表中. ---->获取服务器保存好 ...
- 分享类shareSDK
1.新浪微博分享时需要注意: [A] 应用信息->基本信息->应用地址 [B] 应用信息->高级信息->OAuth2.0 授权设置 //当使用新浪微博客户端分享的时候需要按照下 ...
- valgrind检查C++内存泄漏
valgrind --tool=memcheck --leak-check=full ./httptest Valgrind 使用 用法: valgrind [options] prog-and-ar ...
- 自己动手编译hadoop-2.5.2源码
搭建环境:Centos x 6.5 64bit (后来:我才知道原来官网上发布的就是64位的,不过这个对我来说是个学习过程,对以后进行其他平台编译的时候有帮助!) 1.安装JDK 我这里用的是64位 ...
- Nginx反向代理设置 从80端口转向其他端口
[root@localhost bin]# netstat -lnutp Active Internet connections (only servers) Proto Recv-Q Send-Q ...
- phpexcel中文教程-设置表格字体颜色背景样式、数据格式、对齐方式、添加图片、批注、文字块、合并拆分单元格、单元格密码保护
转:http://www.cnblogs.com/huangcong/p/3687665.html 首先到phpexcel官网上下载最新的phpexcel类,下周解压缩一个classes文件夹,里面包 ...
- Python 自然语言处理(1) 计数词汇
Python有一个自然语言处理的工具包,叫做NLTK(Natural Language ToolKit),可以帮助你实现自然语言挖掘,语言建模等等工作.但是没有NLTK,也一样可以实现简单的词类统计. ...
- Delphi函数参数传递 默认参数(传值)、var(穿址)、out(输出)、const(常数)四类
Delphi的参数可以分为:默认参数(传值).var(传址).out(输出).const(常数)四类 可以对比C/C++的相关知识,类比学习. 1.默认参数是传值,不会被改变,例子 function ...
- 《图形学》实验三:DDA算法画直线
开发环境: VC++6.0,OpenGL 实验内容: 使用DDA算法画直线. 实验结果: 代码: #include <gl/glut.h> #include <math.h> ...