自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(35)
  • 收藏
  • 关注

原创 poj_3386 Frequent values

#include #include #include #include #include #include using namespace std;const int maxn = 100010+100;int dp_max[maxn][20];int f[maxn];int n; int num[maxn];void ST(){ for (int i = 1; i

2014-12-30 11:27:53 250

原创 poj-1330 Nearest Common Ancestors

#include #include #include #include using namespace std;const int maxn = 10000+1000;std::vector tree[maxn];int indeg[maxn];int root;int ancestor[maxn];bool vst[maxn];void BuildTree(int no

2014-12-17 19:22:36 217

原创 堆排序

#include #include #include using namespace std;void Adjust(int arry[], int index, int len){ int lchild = index*2; int rchild = index*2+1; int max = index; if (lchild arry[max]) { max = l

2014-12-12 16:45:41 205

原创 4-在二元树中找出和为某一值的所有路径

#include #include #include #include #include #include using namespace std;struct BinaryTreeNode{ BinaryTreeNode *left; BinaryTreeNode *right; int m_value; int sum; vector s;};queue q;

2014-12-08 16:23:07 207

原创 3-求子数组的最大和

#include #include #include #include using namespace std; int main(int argc, char const *argv[]){ std::vector v ; v.push_back(1); v.push_back(-2); v.push_back(3); v.push_back(10); v.push_b

2014-12-08 14:13:29 190

原创 2-设计包含min函数的栈

#include #include #include using namespace std;struct StackMin{ stack s; stack min; void push(int value) { s.push(value); if (min.empty() == true || min.top() >= value) { min.push(v

2014-12-08 14:11:38 217

原创 1-排序树变成双向链表

#include #include using namespace std;struct BStreeNode{ int m_value; BStreeNode *left; BStreeNode *right;};void addBSTreeNode(BStreeNode *&pCurrentNode, int value){ if (pCurrentNode == N

2014-12-07 15:00:54 196

原创 poj_2309 BST

lowbit 的应用,思路大于代码。#include int main(){ int N; scanf("%d",&N); while(N--) { int a; scanf("%d",&a); int b = a & (-a); b--; printf("%d %d\n",a-

2014-12-02 20:58:39 219

转载 poj_2051 Argus

堆排序,可以用stl里的函数,但是还是复习一下,堆排序的原理吧,先贴代码,再说堆的原理。#include #include #include #include #include #include using namespace std;const int maxn = 1000+10;struct Node{ int id; int time; int

2014-11-29 21:55:28 232

原创 poj_2481 Cows

#include #include #include #include using namespace std;const int maxn = 100000+100;int m;struct cow{ int s; int e; int index;};cow cw[maxn];int ans[maxn];int arr[maxn];bool cmp(cow

2014-11-27 20:18:28 231

原创 poj_1631 Bridging signals

最终转化为最长上升子序列。#include #include #include #include using namespace std;const int maxn = 40000+100;int n;int m;int stack[maxn];int a[maxn];int b_search(int low,int high,int goal){ while(lo

2014-11-27 20:05:48 187

原创 hdu_1198 Farm Irrigation

自己本来写的很乱,看了一下fanxing1的博客,仿照写了一下

2014-11-19 13:20:21 193

原创 hdu_1856 More is better

水题一个,1A,跑得有点慢,C++ 500的样子。

2014-11-18 21:37:38 205

原创 hdu_1272 小希的迷宫

并查集,不仅仅要查询,链接的两点

2014-11-18 15:17:41 191

原创 hdu_3038 How Many Answers Are Wrong

有点晕,关系很快就想好了,但是在getfather的是

2014-11-17 17:57:56 222

原创 hdu-1829 A Bug's Life

种类并查集,注意矢量的关系就OK了。

2014-11-17 13:01:50 215

原创 hdu-2473 Junk-Mail Filter

并查集删点操作以前没有做过这种的,

2014-11-16 20:15:05 215

原创 hdu-1213 How Many Tables

并查集的模板题目

2014-11-16 16:52:16 238

原创 Lcs hdu1159 Common Subsequence

#include #include #include using namespace std;const int maxn = 1300;char str1[maxn];char str2[maxn];int dp[maxn][maxn];int Lcs(){ memset(dp,0,sizeof(dp)); int length1 = strlen(str1+1); i

2014-11-13 22:15:30 212

原创 hdu_1025(二分+LIS)

这道题一开使用结构题存储加排序,各种wa,折腾好意正在

2014-11-08 17:30:50 229

原创 关于全排列

最近在Tc上遇到全排列的问题,于是找出最近

2014-11-07 21:54:00 210

原创 hdu_3746 Cyclic Nacklace

循环节,主要还是Next数组

2014-10-28 13:05:04 193

原创 hdu_1358 period

不多说,就一个求kmp循环节的水题。

2014-10-23 17:18:37 159

转载 践踏堆栈'

践踏堆栈'[C语言编程] n. 在许多C语言的实现中,有可能通过写入例程        中所声明的数组的结尾部分来破坏可执行的堆栈.所谓'践踏堆栈'使用的        代码可以造成例程的返回异常,从而跳到任意的地址.这导致了一些极为        险恶的数据相关漏洞(已人所共知).其变种包括堆栈垃圾化(trash the         stack),堆栈乱写(scribble

2014-09-09 18:11:29 162

原创 最大公约数与最小公倍数

最近在TC上做了一道题,才发现自己q

2014-07-25 17:52:22 245

原创 poj 1298 The Hardest Problem Ever

题目很水,十分水,之所以要做,是想一下STL,

2014-05-28 01:17:28 204

原创 poj 1731 Orders

全排列,根据字典序,可以使用next_permutation

2014-05-25 23:37:40 213

原创 poj 3256 Cow Picnic

DFS水题,开始直接DFS,近800ms,然后使用vector优化

2014-05-20 00:20:18 255

原创 poj 1101 The Game

这个题,discuss里说可能数据比较水,我用了

2014-05-18 11:55:44 265

原创 *Hdu 1026-Ignatius and the Princess I

题目思想比较简单,但是题目要求输出路径比较麻烦,学习了

2014-05-17 00:41:42 419

原创 hdu1010 Tempter of the Bone

#include #include #include #include #include #define N 8using namespace std;int row;int col;int step;int sx,sy,ex,ey;bool can;char maze[N+1][N+1];int dir[4][2]={1,0,-1,0,0,1,0,-1};void D

2014-05-16 01:24:37 182

原创 poj 1979 Red and Black

这道题目是最简单的广度优先搜索了,题目要求是

2014-05-14 23:59:25 239

原创 操作系统——请求分页

[问题描述]  设计一个请求页式存储管理方案,为简单起见。页面淘汰算法采用 FIFO页面淘汰算法,并且在淘汰一页时,只将该页在页表中修改状态位。而不再判断它是否被改写过,也不将它写回到辅存。[基本要求]  页面尺寸1K,输入进程大小(例如5300bytes),对页表进行初始化,页表结构:页    号物理块号状态位0

2012-12-16 10:42:24 426

原创 操作系统——银行家算法

1银行家分配算法,顾名思义是来源于银行的借贷业务,一定数量的本金要应多个客户的借贷周转,为了防止银行加资金无法周转而倒闭,对每一笔贷款,必须考察其是否能限期归还。在操作系统中研究资源分配策略时也有类似问题,系统中有限的资源要供多个进程使用,必须保证得到的资源的进程能在有限的时间内归还资源,以供其他进程使用资源。如果资源分配不得到就会发生进程循环等待资源,每个进程都无法继续执行下去的死锁现象。把

2012-12-16 10:34:33 230

原创 操作系统——进程调度

1、进程调度算法:采用动态最高优先数优先的调度算法(即把处理机分配给优先数最高的进程)。 2、每个进程有一个进程控制块( PCB)表示。进程控制块可以包含如下信息:进程名---进程标示数  ID优先数 PRIORITY  优先数越大优先权越高到达时间---进程的到达时间为进程输入的时间。、进程还需要运行时间ALLTIME,进程运行完毕ALLTIME=0,已用CPU时间-

2012-12-16 09:40:44 309

空空如也

空空如也

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

TA关注的人

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