自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Perl 正则表达式

原文出自:http://263.aka.org.cn/Lectures/002/Lecture-2.1.2/perl-reg.html感谢AKA及作者。 9,Perl 中的正则表达式正则表达式的三种形式 正则表达式中的常用模式 正则表达式的 8 大原则         正则表达式是 Perl 语言的一大特色,也是 Perl 程序中的一点难

2015-05-31 20:47:04 507

原创 hdu 3549 Flow Problem

In this problem ,I get RE so many times,In end ,I know that I write edge[MAXN],It should be write as edge[MAXE].This problem has some problem I don't know.It's so freak.The portal:http://acm.hdu.edu

2015-05-21 09:21:30 422

原创 hdu 1532 Network Flow Drainage Ditches

Using the code solve max_flow problem.I just using the mould.I don't know the details of isap algorithm.ps:This is my first solve Network Flow problem.The portal : http://acm.hdu.edu.cn/showprob

2015-05-20 12:58:44 385

原创 hdu 2923 Floyd The shortest route

Be Attention ,These is may be a  locality has more than one broken-car .Clearly,Floyd is simple than Dijkstra in this problem.The portal:http://acm.hdu.edu.cn/showproblem.php?pid=2923/************

2015-05-15 17:05:20 480

原创 hdu 2722 Dijkstra The shortest route

At the first I think it's a dynamic programming . But the truth hurt my immature soul.It's Dijkstra.At last,I want to say,The input so disgusting.The portal:http://acm.hdu.edu.cn/showproblem.php?p

2015-05-15 00:16:39 397

原创 hdu 1224 Free DIY Tour Flyod

Another Problem be solved by Flyod.Flyod is so powerful.The portal:http://acm.hdu.edu.cn/showproblem.php?pid=1224#include #include #include #define MAXN 105const int INF = 0x3f3f3f3f;int co

2015-05-13 15:33:25 469

原创 hdu 1385 Minimum Transport Cost Floyd

In this problem,First I use dijkstra to solve it.But WA defeated me.I finally use Flyod.The portal:http://acm.hdu.edu.cn/showproblem.php?pid=1385#include #include #include #define MAXN 1005

2015-05-13 14:31:03 385

原创 hdu 1217 Arbitrage Flyod

You should pay attention to the input is directed.The portal :http://acm.hdu.edu.cn/showproblem.php?pid=1217#include #include #include #include #include #include #include #define eps 1e-8

2015-05-10 15:26:17 402

原创 hdu 3339 In Action shortest path

First I use two dimesion dynamic programming algorithm,The answer is TLE,So I improve my algorithm to one dimesion and solve it.The portal :http://acm.hdu.edu.cn/showproblem.php?pid=3339#include

2015-05-10 14:43:59 429

原创 hdu 2680 Choose the best route 最短路

把终点当起点,起点当终点,存边的时候反着存就可以了。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2680#include #include #include const int MAXN = 1010;const int INF = 0x3f3f3f3f;bool vis[MAXN];int pre[MAXN];int c

2015-05-09 21:30:15 403

原创 hdu 3790 最短路径问题 迪杰斯特拉

先选长度小的,长度相等,选花费小的,注意细节即可。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3790#include #include #include const int MAXN=1010;const int INF=0x3f3f3f3f;bool vis[MAXN];int pre[MAXN];int cost[MAX

2015-05-09 18:09:25 400

原创 hdu 1869 六度分离 Floyd

Floyd的应用:if(d[i][j]>d[i][k]+d[k][j]) d[i][j] = d[i][k] + d[k][j] + 1;表示d[i][j]多出来了k这个人。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1869#include #include #include int d[105][105];void Input

2015-05-09 16:06:08 454

原创 hdu 2544 最短路

用迪杰斯特拉或者flyod皆可。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2544迪杰斯特拉版本:#include #include #include const int MAXN=105;const int INF=0x3f3f3f3f;bool vis[MAXN];int pre[MAXN];int cost[M

2015-05-09 15:56:39 341

原创 hdu 2846 字典树

用指针版本在HDUOJ上的G++会超内存,用C++可以过。用数组版本在HDUOJ上的G++就可以过了。指针版本和数组版本其实用的内存理论上是等价的。原来应该是HDUOJ的评测机是windows运行G++,编译应该会有一些问题。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2846指针版本:#include #include

2015-05-09 13:33:18 472

原创 hdu 2072 单词数 字典树

简单字典树,我看错了题目,郁闷了好一会,沙茶了一把。(次次沙茶QAQ)传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2072#include #include #include #define maxn 30struct Trie{ Trie * next[maxn]; int v;};Trie * root;

2015-05-08 23:41:17 485

原创 hdu 3460 Ancient Printer 字典树

这题的答案就是(节点数*2)+(n)-(最长串的长度)。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3460#include #include #include #define maxn 30struct Trie{ Trie * next[maxn]; int v;};Trie * root;int cn

2015-05-08 21:52:32 437

原创 zoj 2853 Evolution 矩阵快速幂

在我的电脑上code::blocks运行过不了,但代码是可以AC的,很是郁闷。问了大神,知道了函数的参数是放在栈区,结构体太大的话,栈就爆了,如是后来就听从大神的意见用引用改写了。传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1853#include #include #include int

2015-05-08 19:01:43 646

原创 zoj 3497 Mistwald 矩阵快速幂

知道了矩阵的新作用,矩阵A^P,A[i][j]的数值是从i到j长度为P的路径条数,矩阵相乘如果A[i][k为1,B[k][j]为1,A[i][j] 必然>=1,表明以k为桥梁将i和j连接起来,和floyd算法本质上是一致的。传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4320#include #incl

2015-05-08 00:30:06 407

原创 hdu 1757 A Simple Math Problem 矩阵快速幂

推出矩阵公式即可:(盗图)传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1757#include #include #include int len_Matrix;int Mod;struct Matrix{ int M[15][15];};int tempa[15];int a[15];void In

2015-05-07 21:37:40 357

原创 hdu 2604 Queuing 矩阵快速幂

推出矩阵的公式即可:传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2604#include #include #include using namespace std;int len_Matrix;int Mod;struct Matrix{ int M[15][15];};void Init_Matrix(

2015-05-07 21:15:20 343

原创 hdu 1247 Hat’s Words 字典树

有几个地方要注意1.分割字符串的细节2.可能需要按字母表排序3.搜索字典树的时候不要搜成了前缀,注意是一个字符串的终结传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1247#include #include #include #include #define maxn 30using namespace std;c

2015-05-06 23:38:43 335

原创 zoj 1109 字典树

此题用map也可过,我用的是线段树传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1109#include #include #include #define maxn 30struct Trie{ Trie * next[maxn]; char * english;};Tr

2015-05-06 16:46:28 491

原创 hdu 1800 Flying to the Mars 字典树

这是字典树写法,也可用字符串hash开始因为没开字符数组wa了几发,然后发现前导0没删,然后又发现删前导0的函数写错了,QAQ传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1800#include #include #include #define maxn 15struct Trie{ Trie * next[ma

2015-05-05 23:31:06 365

原创 hdu 1298 T9 字典树+DFS

开始我算法复杂度估计错误,纠结了很久,没想到直接深搜穷举。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1298#include #include #include #define maxn 30struct Trie{ Trie * next[maxn]; int v;};Trie * root;int p

2015-05-05 22:48:42 595

原创 hdu 1075 What Are You Talking About 字典树

因为没开字符串数组WA到爽。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1075#include #include #include #define maxn 30char a[500050][15];struct Trie{ Trie * next[maxn]; char * english;};Tri

2015-05-05 19:08:57 447

原创 hdu 1251 统计难题 字典树

在hdu上要用c++提交,要不然会超内存。传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1251#include #include #include #define maxn 30struct Trie{ Trie * next[maxn]; int v;};Trie * root;void Init_Tr

2015-05-05 08:11:49 376

原创 hdu 1671 Phone List 字典树

第一次写字典树传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1671#include #include #define maxn 15using namespace std;struct Trie{ Trie * next[maxn]; int v;};Trie * root;int flag;vo

2015-05-05 00:18:36 404

原创 hdu 3264 Open-air shopping malls 计算几何 相交圆的面积 二分

枚举每个点作为雨伞圆心,二分雨伞半径长度即可传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3264#include #include #define pi acos(-1.0)struct Circle{ double x,y,r;};Circle a[25];int n;double dist(double x1

2015-05-03 19:46:45 701

空空如也

空空如也

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

TA关注的人

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