- 博客(13)
- 资源 (2)
- 收藏
- 关注
原创 poj 1157 LITTLE SHOP_简单dp
题意:给你n种花,m个盆,花盆是有顺序的,每种花只能插一个花盘i,下一种花的只能插i简单dp#include #include#includeusing namespace std;#define N 110int dp[N][N],a[N][N];int main(int argc, char** argv) { int n,m,i,j; while(scanf("%d%
2013-11-27 20:58:57 495
原创 poj 1088 滑雪_记忆化搜索
题意:略直接用记忆搜索就行了#include#includeusing namespace std;int n,m;int map[105][105];int len[105][105]={0};int dp(int x,int y){ int max,temp; if(len[x][y]) return len[x][y]; max=0; if(x+1map[x
2013-11-27 20:02:49 437
原创 poj 1083 Moving Tables_dp
题意:给你n个凳子,接着告诉你一个凳子从a房间到b房间,运输时间为10分钟,走廊很窄能通过一张凳子,当然不堵塞的话能同时扮凳子,问最小花费多少时间因为数据很小就直接用数组统计了,a,b如果是奇数的话就变成偶数(这个不冲突),直接累加过去。#include #include#include#includeusing namespace std;#define N 410int m
2013-11-26 22:49:32 527
原创 poj 1050 To the Max_dp求最大子矩阵和
题意:求最大子矩阵和利用dp[i]每次向下更新,构成竖起的单条矩阵,再按不小于零就加起来来更新,构成更大的矩阵#include #include#include using namespace std;#define N 110int map[N][N],dp[N];int main(int argc, char** argv) { int n,i,j,k,maxn,ans;
2013-11-26 21:48:36 401
转载 POJ 动态规划题目列表
]POJ 动态规划题目列表容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平 衡), 1936
2013-11-26 21:07:34 673
原创 poj 1018 Communication System_贪心
题意:给你n个厂,每个厂有m个产品,产品有B(带宽),P(价格),现在要你求最大的 B/P明显是枚举,当P大于一定值,B/P为零,可以用这个剪枝#include #include#includeusing namespace std;#define N 110#define INF 0xffffffint devb[N][N],devp[N][N];int b[N*100],
2013-11-26 18:47:51 527
转载 线段树(一) _概述 基本操作
线段树 Segment_tree网上有人把线段树翻译成 Interval_TreeInterval_Tree 是另外一种数据结构 而且并非二叉树这个是线段树的标准E文翻译可以看wikipedia的原文 http://en.wikipedia.org/wiki/Segment_tree顾名思义 线段树存储的是连续的线段而非离散的节点先看一张经典的线
2013-11-22 19:56:59 593
转载 计算几何之凸包_卷包裹算法
====================================================================一.凸集&凸包(下文中所有的集合 若不作特殊说明 都是指欧氏空间上的集合)凸集(Convex Set):任意两点的连线都在这个集合内的集合就是一个凸集.A set in Euclidean space is convex set if it co
2013-11-20 21:11:21 1010
原创 poj 3761 Bubble Sort_快速幂
题意:问你冒泡排序第i次排序,一共排了多少次套公式K!((K + 1) ^ (N - K) - K ^ (N - K))#include #include#includeusing namespace std;#define LL long long#define N 1000010#define M 20100713LL a[N];int _pow(LL v,int k)
2013-11-13 22:35:50 748
原创 hdu 2157 How many ways_ 矩阵快速幂
题意:略直接矩阵乘法就行了#include #include#includeusing namespace std;#define LL __int64#define N 30int n,m;struct node{ int mat[N][N]; node operator *(const node &x){ node tmp;
2013-11-13 22:29:30 629
原创 hdu 1757 A Simple Math Problem_矩阵快速幂
题意:略简单的矩阵快速幂就行了#include #include #include using namespace std;#define LL long long #define N 10int m;struct node{ int mat[N][N]; node operator *(const node &x){ node tmp; memset(tmp.
2013-11-13 22:20:26 600
原创 poj 3753 Training little cats_矩阵快速幂
题意: 通过各种操作进行,给第i只猫花生,第i只猫吃光花生,第i只猫和第j只猫互换花生,问n次循环操作后结果是什么很明显是构建个矩阵,然后矩阵相乘就好了#include #include #includeusing namespace std; #define LL long long #define N 110LL n,m,d;struct node{ LL mat[N]
2013-11-13 22:06:49 648
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人