自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 数独

13年9月25号写的数独程序,虽然不怎么高大上,不过还是记录下。。#include#include#include#includeusing namespace std;//每行、列、小九宫中未用数字setset_row[9];setset_col[9];setset_area[9];char grid[10][10];//保存正在尝试的填充struct stak

2015-05-22 10:10:25 486

原创 一个delete和析构函数引发的coredump

在一段代码中写了一段类似这样的代码:std::map data2itor;std::multimap tim2data;用tim来定时删除过期数据,正常删除时由data2itor中的second确定在tim2data中的位置从而删除,超时时由time2data确定超时数据,进行删除,数据是一个结构体的指针,在超时的时候要对结构体进行delete,但是在delete的时候在析构函数里做了

2015-04-18 17:22:09 3832

原创 记录一例内存泄漏

C++中基类的析构函数一直被要求写为virtual,是为了让子类正确的释放其实分配的空间,以前一直觉得主要是new出来的内存需要释放,这几天遇到一个内存泄漏问题,起因是new了子类对象,赋值给基类指针,但基类忘记写virtual的析构函数了,第一次将基类析构函数不写成virtual的效果由理论转成了实践,发现原来不只动态分配的内存需要子类的析构函数去释放,valgrind检查后发现包括原子类型的内

2014-12-31 14:03:39 450

原创 pure virtual method called

记录一个编写多线程程序时遇到的运行时错误:pure virtual method called起因是写了一个多线程基类,里面有一个纯虚函数run,子类继承了这个run,重点就在纯虚函数上,因为是在基类中构造时创建的线程,线程创建后直接运行run函数,而这时子类尚未构造,所以run函数此时依旧是纯虚函数,就会出现pure virtual method called这个错误而终止运行,感谢http

2014-12-26 16:38:24 4499 1

转载 13个mysql数据库的实用SQL小技巧

MYSQL作为最成功的开源关系型数据库之一,拥有大批的粉丝(本人也是),在这篇文章中,我们精心收集了10个最实用的mysql查询技巧,希望能够带给大家惊喜,如果大家也有非常不错的SQL,请留言与我们分享! 相关阅读:SQL  ,MYSQL使用CASE来重新定义数值类型SELECT id,title, (CASE date WHEN '0000-00-00' THEN ''

2013-11-11 15:23:01 487

转载 让程序员最头疼的事儿是什么?给变量起个有意义的名字

这是一个来自Quora的问题,“起有意义的变量名”得票最多,其他一些头疼的事儿还有:向家人解释自己从事的工作究竟是什么估计任务完成的时程理解没有注释的大段代码完成自己不认同的功能必须碰别人的糟糕代码(这可能是因果报应)写详尽的文档写测试

2013-11-02 20:13:11 829

原创 code::blocks编译多文件

code::blocks是一款据说灰常强大的IDE,以前虽然也经常使用,但一没用过高度功能,二来没用它写过工程性的东西,简单点说就是一个以上的源文件并且加入其他非标准的头文件,今天想做一个多文件的语法的测试,用的CB,结果却非常不幸的无法编译过,在主函数里调用另一个源文件里的函数,却提示没有定义的引用,若干分钟后终于找出原因:在Manager窗口(就是源文件、头文件等文件的列表窗口)里,在定义

2013-04-02 16:52:08 5207 2

转载 浅谈 div 与 table 如何取舍结合利用

和webpage打交道起页面布局就一直是我关注的内容,从早期table构架页面到DIV再到DIV+Table,可以说我们的需求一直在变,但是目的一直没有改变。为什么这么说,很明显从简单到复杂,再从复杂到简单;从简单运用到复杂运用;一切都是围绕需求性来做的。很多开发设计人员在从事页面布局开发的时候都要考虑到几点:布局是否合理,结构是否紧凑,是否有充分的扩展性,可读性是否强。而合理使用Table和DI

2012-12-21 08:04:43 554

转载 解决HDU爆栈的问题 .

转载:http://forum.byr.edu.cn/article/ACM_ICPC/51264 大家懂的,鉴于HDU用的是windows服务器,所以stack大小及其坑爹,稍微深一点的递归栈就会stack overflow。 通常的规避方法是用stack或者手写stack模拟栈的递归过程。这个极其蛋疼啊,而且被卡了STL也很得不偿失唉。(话说这一切都是基于非现场赛来说的,现场赛怎么

2012-09-10 10:58:44 662

转载 虚函数的实现机制

C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来实现可变的算法。比如:模板技术,RTTI技术,虚函数技术,要么是试图做到在编译时决议,要么试图做到运行时决议。关于虚函数的使用方法,我在这里不做过

2012-09-01 17:07:11 533

转载 读懂diff

读懂diff作者: 阮一峰  发布时间: 2012-08-30 06:46  阅读: 53 次  原文链接  全屏阅读  [收藏]     diff 是 Unix 系统的一个很重要的工具程序。  它用来比较两个文本文件的差异,是代码版本管理的基石之一。你在命令行下,输入:$ diff   diff 就会告诉你,这两个文件有何差异。它的显示结果不太好

2012-08-30 09:53:48 645

原创 ZOJ 3642

Just Another Information Sharing ProblemTime Limit: 2 Seconds      Memory Limit: 65536 KB There is going to be another test in the kindergarten. Again the teacher has already told every kid

2012-08-28 18:40:00 373

原创 ZJU 3633

Alice's presentTime Limit: 5 Seconds      Memory Limit: 65536 KB As a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip can be treated as

2012-08-27 21:14:22 425

原创 POJ 3084 最大流

Panic RoomTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1592 Accepted: 789DescriptionYou are the lead programmer for the Securitron 9042, the latest and

2012-08-27 14:04:43 556

原创 POJ 1182 食物链

食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 30668 Accepted: 8944Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,

2012-08-22 15:13:19 354

原创 POJ 1797 Heavy Transportation

Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 15562 Accepted: 4044DescriptionBackground Hugo Heavy is happy. After the breakdown o

2012-08-22 13:18:14 376

原创 POJ 2396 上下界可行流

BudgetTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 4378 Accepted: 1679 Special JudgeDescriptionWe are supposed to make a budget proposal for this m

2012-08-22 09:44:59 458

原创 POJ 3422 卡卡的矩阵之旅 最大费用流

Kaka's Matrix TravelsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5806 Accepted: 2266DescriptionOn an N × N chessboard with a non-negative number in

2012-08-22 09:43:23 1215

原创 HDU 2489

题目:Minimal Ratio TreeTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1140    Accepted Submission(s): 348Problem DescriptionFor a

2012-07-31 18:25:24 844

原创 ZJU 2588 割边

ZOJ2588找割边,将重边看成回边,用一个数组标记一个边号是否是割边,开始这个数组开成点数的大小了,WA了一天没找到  超级巨囧~~~//problem_id zoj 2588#include#include#include#include#include#include#include#include#include#includeusi

2012-07-31 10:59:57 497

原创 POJ 1966 点连通度

Cable TV NetworkTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2912 Accepted: 1348DescriptionThe interconnection of the relays in

2012-07-30 13:34:29 539

原创 POJ 1523 割点

//翻译见图论书390页 #include#include#include#includeusing namespace std;#define MIN(a,b) ((a)<(b)?(a):(b))int mp1[1005];int mp2[1005];int g[1005][1005];int n;int low[1005];int v

2012-07-28 10:44:02 505

原创 POJ 2186 强连通分量

题目:Popular CowsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16768 Accepted: 6740DescriptionEvery cow's dream is to become the most popular cow in the

2012-07-27 09:45:18 876

原创 HDU 1272 拓扑排序

#include#include#include#includeusing namespace std;int p[100005];int r[100005];bool fl[100005];int yes;int node_count;int edge_count;void init(){ for(int i=1;i<

2012-07-18 17:46:21 378

原创 ZOJ2770 差分约束

#include#include#includeusing namespace std;#define EDGE_COUNT 30000#define PNT_COUNT 2000#define INF 0x1f1f1f1fstruct edge{ int adj; int point; int weight; edge(int a,int

2012-07-16 14:26:15 489

转载 win32 API函数大全

win32 API函数大全 网络应用虚拟机Windows数据结构应用服务器 1. API之网络函数 WNetAddConnection 创建同一个网络资源的永久性连接 WNetAddConnection2 创建同一个网络资源的连接 WNetAddConnection3 创建同一个网络资源的连接 WNetCancelConnection 结束一个网络连接

2012-07-12 15:26:39 1030

原创 POJ 2516 最小费用流

做的第一个最小费用流问题,第一次忘了费用乘以流量 WA了一次,每次输入一个矩阵都运行一次最小费用流即可。  #include#include#include#includeusing namespace std; #define INF 0x1f1f1f1f#define MIN(a,b) ((a) int store[60][60];//储量i

2012-06-05 08:11:08 341

原创 POJ 1273 一般性预流推进

#include#include#includeusing namespace std;#define MIN(a,b) (a)<(b)?(a):(b)int m,n;int flow[202][202];int cap[202][202];int e[202];int h[202];void fun(){ //Init memset(flow,0,sizeof(f

2012-04-28 20:07:51 417

原创 poj 1273 Dinic

#include#include#include#includeusing namespace std;#define MIN(a,b) (a)<(b)?(a):(b)int flow[205][205];int cap[205][205];int lev_net[205][205];int mx[205];bool fl[205];int m,n;int res;

2012-04-26 11:40:26 435

原创 heap+prim

#include#includeusing namespace std;struct node{int num;int dis;node(int n,int d):num(n),dis(d){}node(){}};int n;node h[500000];void insert(node nd,int& len){

2012-04-25 11:57:14 600

原创 Ford-furkson

int flow[205][205];int cap[205][205];int m,n;//m表示边数,n表示点数,均从1开始int ford_furkerson(){ int ret=0; bool fl[205]; int pre[205]; int ft[205]; while(1) { memset(fl,0,sizeof(fl)); memset(p

2012-04-21 23:55:00 428

原创 poj 1273 Ford_fulkerson

第一个网络流题,虽水还是记念一下,因为忘了将反向边每次更新,无耻的贡献了N次WA~用的是算法导论上的第一个算法,比较慢的Ford_fulkerson,广搜找增广路,每次记录每个节点的前驱节点以到该节点路径中的最小流#include#include#include#includeusing namespace std;int flow[205][205];int cap[205][20

2012-04-20 17:15:18 626

原创 poj 1935 journey 树DP

JourneyTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1425 Accepted: 523DescriptionThere are n cities in Byteland (numbered from 1 to n), connected b

2012-04-11 20:21:04 763

原创 POJ 3272 cow traffic

题目:Cow TrafficTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3117 Accepted: 833DescriptionThe bovine population boom down on the farm has caused serious congestion on the cow

2012-04-05 12:06:13 934 1

原创 poj 1087 a plug for unix

题目:A Plug for UNIXTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10861 Accepted: 3562DescriptionYou are in charge of setting up the press room for the inaugural meeting of the

2012-04-01 09:27:20 798

转载 vim

Vim基本操作发表于 2011 年 01 月 18 日 由 admin1. Vim的几种模式Vim提供了诸多模式可供使用,不同模式带有不同的命令功能。普通模式 启动后的默认模式。普通模式下,用户的按键被解释为各种Vim内置命令(如移动光标,删除/查找/替换文字等)。Vim强大的功能大部分即来自普通模式。在普通模式下,按键'a'或'i等即可切换至插入模

2012-03-31 21:04:16 503

原创 HRBEU 1121 二分枚举

题目:Kth LargestTimeLimit: 1 Second   MemoryLimit: 32 MegabyteTotalsubmit: 442   Accepted: 161  DescriptionThere are two sequences A and B with N (1<=N<=10000) elements each. All of the elemen

2012-03-31 19:58:25 440

原创 POJ 2060 最小路径覆盖

题目:Taxi Cab SchemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 4432 Accepted: 1868DescriptionRunning a taxi station is not all that simple. Apart from the obvious demand for

2012-03-31 19:54:19 701

原创 HDU 1678

ShopaholicTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 761    Accepted Submission(s): 425Problem DescriptionLindsay is a shop

2012-03-31 19:46:38 824

原创 HDU 1896

题目:***查看报名情况***StonesTime Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 296    Accepted Submission(s): 162Pro

2012-03-31 19:44:45 684

空空如也

空空如也

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

TA关注的人

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