自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 收藏
  • 关注

原创 HDU2571一个裸的最长公共子序列题

这个题就是裸的到处比较一下就可以了 关键点是找出哪几个值是不用算的 这样看其实是最后一列不用算#include<iostream>#include<algorithm>#include<memory.h>#include<cstdio>using namespace std;int zhi[21][1001];int dp[21][1001];int main(){ in

2016-07-29 18:55:46 323

原创 HDU1069终于会一个不算水的DP

Problem Description A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some

2016-07-29 11:41:23 925

原创 HDU1029

学长们把他放在DP里 … 不太明白 明明超级水啊#include<iostream>#include<cmath>#include<cstdio>#include<string>#include<algorithm>#include<memory.h>#include<stack>using namespace std;int dp[999999];int main(){

2016-07-28 18:48:10 237

原创 HDU1087最长上升子序列

这个题思路也很简单 关键点在于dp只要记录当前的【答案】这个就可以了 这是DP最重要的地方 然后贴着答案往上凑 (很怨念)#include<iostream>#include<cmath>#include<cstdio>#include<string>#include<algorithm>#include<memory.h>#include<stack>using namesp

2016-07-28 18:38:15 269

原创 HDU1159最长公共子序列

这个题貌似是算法导论的原题 不过本着能循环坚决不用递归的态度 我认真地写了循环… 关键其实就是一个转移方程 如果两个字节一样,他就等于 dp[a][b]=dp[a+1][b+1]+1; 如果不一样就找两边最大的 dp[a][b]=max(dp[a][b+1],dp[a+1][b]); 另外在DP题里有点找到感觉了,如果想要用循环就先找到以前递归的感觉,然后自底向上加回去#includ

2016-07-28 16:16:35 615

原创 HDU1275DP

题目的关键是求最长非递增数列的数量,因此dp数组用来存放每一条数列的最小值 当这个值比所有的都要小的时候 就开一个新的数列 否则就更新… 多做题啊骚年#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>#include<string>#include<memory.h>using namespac

2016-07-28 15:05:44 281

原创 HDU1176二维DP

这个题没什么难的 从地下往上面走 多体会#include<iostream>#include<string>#include<cmath>#include<cstdio>#include<algorithm>#include<memory.h>using namespace std;int dp[12][100005];int main(){ int n; wh

2016-07-27 19:07:25 213

原创 HDU1108求个最大公因数

水.. 主要是最大公因数要忘干净了#include<iostream>#include<string>#include<cmath>#include<algorithm>#include<memory.h>using namespace std;long long shu[1200];int ge;void jinqu(string qq){ long long s=0;

2016-07-27 11:05:47 450

原创 HDU1106

水题但是有坑 要注意第一个是5的情况和最后一个没处理的情况#include<iostream>#include<string>#include<cmath>#include<algorithm>#include<memory.h>using namespace std;long long shu[1200];int ge;void jinqu(string qq){ lo

2016-07-27 10:38:10 360

原创 HDU1326

水#include<iostream>#include<cstdlib>#include<memory.h>#include<map>using namespace std;int ss[500];int main(){ int n; int sd=0; while(cin>>n) { if(n==0)break; sd+

2016-07-22 09:27:09 359

原创 HDU1856

数据超弱并查集 只要十万就能过#include<iostream>#include<cstdlib>#include<memory.h>#include<map>using namespace std;int dian[100001];int book[100001];int gen(int v) { int t1,t2=v; while(v!=dian[

2016-07-22 09:25:46 274

原创 HDU2818加权并查集

Problem Description John are playing with blocks. There are N blocks (1 <= N <= 30000) numbered 1…N。Initially, there are N piles, and each pile contains one block. Then John do some operations P times

2016-07-22 09:24:18 448

原创 HDU1233

超级弱智最小生成树#include<iostream>#include<queue>#include<stack>#include<cstdlib>#include<memory.h>using namespace std;int dian[101];struct p{ int u,v,juli; bool operator <(const p &a) const

2016-07-20 16:22:56 203

原创 HDU1213

并查集超级水题#include<iostream>#include<queue>#include<stack>#include<cstdlib>#include<memory.h>using namespace std;int map[1001];int book[1001];int gen(int x){ while(x!=map[x]) { x=

2016-07-20 14:44:20 286

原创 HDU1232并查集

这道题大概就是很裸的并查集了 主要的思路大概就是 并查集一遍 然后找找到底有几个根节点 就可以了#include<iostream>#include<queue>#include<stack>#include<cstdlib>#include<memory.h>using namespace std;int map[10011];int book[10011];int gen

2016-07-20 13:25:00 273

原创 HDU1873

锻炼一下队列#include<iostream>#include<functional>#include<queue>#include<string>#include<vector>#include<cstdio>#include<cstdlib>using namespace std;struct ren { int x; int quanzhong; bo

2016-07-19 20:29:35 269

原创 HDU1216

水模拟#include<iostream>#include<algorithm>using namespace std;long long s[999999] = { 0 };int main(){ s[0] = 1; s[1] = 1; for (int a = 2;a <= 50000;a++) { if (s[a] == 1)conti

2016-07-19 20:28:33 349

原创 HDU1198

别人都用的dfs,并查集 我用的bfs也过了#include<iostream>#include<algorithm>#include<queue>#include<functional>#include<vector>#include<string>#include<cstdlib>#include<stack>using namespace std;int zujian[11

2016-07-19 20:27:51 250

原创 HDU4006

简单的优先队列应用#include<iostream>#include<algorithm>#include<queue>#include<functional>#include<vector>using namespace std;struct cmp2 { bool operator ()(int &a, int &b) { return a>b; }

2016-07-19 20:26:28 197

原创 求最大值....

这题讲道理这贪心策略我自我感觉良好…… 先从左边求最大,再从右边求最小 如果从左边找到了比右边还小的 那么久更新差值 反之同理 描述 给定n个数,a[1]到a[n],请你帮忙找出a[i] - a[j]的最大值,其中1 <= i < j <= n输入 第一行一个数T,表示一共有T组数据(T <= 20); 每组测试数据第一行一个整数n(2 <= n <= 10 ^ 5),表示接下来有n个

2016-07-15 17:31:36 379

原创 HDU1006

我只是想存一下这些水题的代码#include<iostream>#include<algorithm>#include<cmath>#include<iomanip>using namespace std;int main(){ int n; while (cin >> n) { if (n == -1)break; int sum

2016-07-14 11:27:26 225

原创 HDU1016

都很水…#include<iostream>#include<string>#include<cmath>#include<algorithm>#include<queue>#include<stack>#include<cstring>using namespace std;int prime[38] = { 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

2016-07-14 11:25:47 293

原创 HDU1012打表之魂永流传

灵魂打表 别揍我….#include<iostream>using namespace std;double jie[10];int main(){ printf("n e\n- -----------\n"); printf("0 1\n1 2\n2 2.5\n3 2.666666667\n4 2.708333333\n5 2.716666667\n6 2.7180555

2016-07-14 11:23:42 384

原创 HDU1019

超级水题还要什么题解….#include<iostream>#include<cmath>#include<algorithm>using namespace std;int gcd(int a, int b){ if (b == 0) return a; return gcd(b, a%b);}int main(){//?4 294 967 296 int

2016-07-14 11:21:57 189

原创 HDU1022

十分水,就是模拟模拟就可以了…. 先把这一大堆东西放到两个队列一个栈里,栈就是站点 队列就是火车…. 如果合适就开出去不行就摞上 直到都罗进去站点还是开不动就结束 As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to scho

2016-07-14 11:19:37 349

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除