自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(100)
  • 资源 (1)
  • 收藏
  • 关注

转载 【转】hash_map 与 hash_set 详解

转自:http://blog.csdn.net/kuailekemi/article/details/79699261 数据结构:hash_map原理这是一节让你深入理解hash_map的介绍,如果你只是想囫囵吞枣,不想理解其原理,你倒是可以略过这一节,但我还是建议你看看,多了解一些没有坏处。hash_map基于hash table(哈希表)。 哈希表最大的优点,就是把数据的存

2015-06-04 23:35:46 440

原创 CSPRO

201412-5 货物调度//201412-5 货物调度 #include #include#include#define V 720#define E 160000#define MIN(a,b) ((a)<(b)?(a):(b))#define OPPOSITE(x) (((x)&1)?((x)+1):((x)-1))const int inf=0x3f3f3f3f;

2015-05-09 11:25:24 576

原创 ##单纯形法##

/* * Description: * 线性规划 单纯形法实现 * Usage: * MAXN:最大变量个数 * MAXE:最大不等式个数 * n=变量个数,m=不等式个数 * 目标函数为 sum{x[i]*A[0][i];0<=i<n}+A[0][n] * 约束条件为 * 1) x[i]>=0 for 0<=i<n * 2) sum{x[i]*A[

2015-04-15 17:15:35 626

转载 【转】这么多计算几何题目,够你练了

FOJHotter Colderhttp://acm.fzu.edu.cn/problem.php?pid=1014 求线段的中位线,线段相交求交点,求凸多边形的面积,无归之室http://acm.fzu.edu.cn/problem.php?pid=1016 本题精度要求非常高,用三角函数的话,很容易就wa..Reflectionshttp://acm.fzu.edu.cn/pr

2015-04-05 22:44:38 1400

原创 搜索剪枝

LA  6761

2015-03-25 10:15:38 341

原创 恶意卡TLE && 测评时判断OJ是否将TLE判成RE或WA

大部分oj能识别恶意卡tle的代码,但实在要卡还是可以做到的。//能识别的for(int i=1;i<=1000000000;i++)for(int j=1;j<=1000000000;j++)tt=i+j;//不能识别的scanf("%d",&n);//某个输入for(int i=1;i<=1000000000;i++){ n+=i; n-=i;}

2015-03-24 21:54:25 1402

原创 uva 11604

//!!!!!!!!!!!错误程序和反例#include#include#include#include#includeusing namespace std;const int maxn = 100+5;char weapon[maxn][25];char buffer[maxn];int L;bool sel[maxn];bool vis[maxn];int len[

2015-03-19 15:13:31 516

原创 LA 2666 最短路神题

#include#include#include#include#include#include#include#include#include#define sqr(x) (x)*(x)#define f1 first#define f2 second#define pb push_back#define fr(i,x,y) for(int i=x;i<=y;++i)

2015-03-17 23:41:09 400

原创 筛子及类筛子题号

六面筛子:LA 3708LA 2925(标称初值top、front、left当成(1,2,3),而根据题意应该是(1,2,4)才对)

2015-03-15 01:08:54 544

原创 LA 3310 SPFA判正环

复习判正环两种方法:1、spfa入队总次数达2*(N+M)则认为存在正环2、所有点d数组初值为0+spfa_dfs参考 《spfa的优化及应用》——姜碧野之前做过的另一题http://blog.csdn.net/chm517/article/details/9389837#include#include#include#include#include#include

2015-03-14 13:18:45 518

转载 【转】#、##、#@在#define中的用法

转自  http://blog.csdn.net/beanjoy/article/details/7577944有如下C++代码:[cpp] view plaincopy#include   using namespace std;    #define A(exp) cout   #define B(exp) cout

2015-03-07 22:50:50 344

原创 ##圆与三角形交##

Point Zero=Point(0,0);d_ common_area(Circle C,Point A,Point B){ // if(A==B) return 0; if(A==C.c||B==C.c) return 0; d_ OA=length(A-C.c),OB=length(B-C.c); d_ d=distance_to_Line

2015-03-02 02:13:45 362

转载 POJ 计算几何入门题目推荐

转自:http://blog.csdn.net/tyger/article/details/4480029【转】 POJ计算几何计算几何题的特点与做题要领:1.大部分不会很难,少部分题目思路很巧妙2.做计算几何题目,模板很重要,模板必须高度可靠。3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板。如果代码一片混乱,那么会严重影响做题正确

2015-03-01 23:43:55 387

原创 uva 11177 圆与凸多边形交

//way1#define N 155Point a[N],aa[N];d_ rr;vector re;bool ok(d_ mid){ d_ tot,ar,ar2=0; tot=ar=pi; Point y(0,0); Circle c(y,mid); fr(i,0,n-1) { re.clear();

2015-02-27 23:33:19 610

原创 圆弧并 uva 10969 && LA 2572

inline double ensure_angle(double v){while (v<-eps)v+=pi*2;return v;}Circle p[105];int topmost(Point q,int t=0){ int ans=-1; for(int i=n-1;i>=t;i--)//下界必须为0,为了减少计算量会出错 { if((len

2015-02-26 02:17:09 438

转载 马尔法蒂问题~~~~~~~~~~~~~~~~~~~~~~

#include#include#include#includeconst double eps=1e-10;const double PI=acos(-1);using namespace std;struct Point{ double x; double y; Point(double x=0,double y=0):x(x),y(y){}

2015-02-26 01:24:49 1449

原创 POJ 2079 旋转卡壳

//check if all is d_ ,convenient to double &&long double#include#include#include#include#include#include#include#include#define sqr(x) (x)*(x)#define f1 first#define f2 second#define pb pu

2015-02-24 23:59:32 375

转载 LA 3218 两种解法

解法一:直接求PSLG,转自http://blog.csdn.net/jingqi814/article/details/25575569// LA3218/UVa1340 Find the Border// Rujia Liu// 注意:本题可以直接使用“卷包裹”法求出外轮廓。本程序只是为了演示PSLG的实现#include#include#include#include#in

2015-02-23 20:57:52 544

转载 【转】 计算几何中的精度问题

计算几何头疼的地方一般在于代码量大和精度问题,代码量问题只要平时注意积累模板一般就不成问题了。精度问题则不好说,有时候一个精度问题就可能成为一道题的瓶颈,简直“画龙点睛”。这些年的题目基本是朝着越来越不卡精度的方向发展了,但是也不乏一些%^&%题#$%$^,另外有些常识不管题目卡不卡,都是应该知道的。今天我就开膛回顾下见过且还有印象的精度问题,由于本人见识和记忆均有限,望各位大神瞄过后不吝补充。另

2015-02-13 14:51:43 343

原创 14年省赛K题:www

#define N 100005int vis[N],num[N];const int mod=1000000007;int o;int n,m,g,A,B;int a[105],b[105];LL ans[105];vector aa;map ma;int dp[105][8000];LL pow(LL a,LL n,LL mod){ LL res=1; whi

2014-10-05 19:54:42 693

原创 uva 11139 格点计数问题

#include#include#include#include#includeusing namespace std;typedef long long LL;int n;#define N 125int gc[N][N],sum1[N][N],sum2[N][N];LL dp[N][N];LL fff(int x,int y){ if (x>y) swap(x

2014-09-27 21:43:09 1032

原创 ACdream 1192 双联通

#include #include #include #include #include #include #include #include #include #include #define pb push_back#define pu push#define mp make_pair#define eps 1e-9#define zero(x) (fabs(x)<

2014-09-21 19:58:22 545

原创 hdu 5031

一组数据15 41 1 1 0 01 1 1 1 01 1 1 1 21 1 2 1 11 1 1 1 10 0 1 1 1

2014-09-20 22:22:31 933

原创 ##数论模版##

/**************以下为常用算法************///把n的约数的莫比乌斯函数值用map的形式返回O(sqrt(n))map&lt;int,int &gt; moebius (int n){ map&lt;int,int &gt; res; vector&lt;int &gt; pri; for (int i=2;i*i&lt;=n;i++) ...

2014-09-16 13:48:38 474

原创 POJ 2115 ax≡c(mod b)求最小非负x

//ax≡c(mod b),已知a,b,c,求最小非负x解(记为ans)//Solution://存在唯一(x,y)ax+by=gcd(a,b);//令gcd(a,b)=d,调用exgcd求x,y,d;//if (c%d!=0) 无解!//a1=a/d;//b1=b/d;//c1=c/d;//ans=(x*c1%b1+b1)%b1;

2014-09-15 18:19:34 516

原创 hdu 5010 大搜索

#include #include #include #include #include #include #include #include #define pb push_back#define mp make_pair#define eps 1e-9#define zero(x) (fabs(x)<eps)#define pi acos(-1.0)#define

2014-09-15 17:07:01 602

原创 Hdu 1573 线性同余方程组

#include #include #include #include #include #include #include #include #include #define pb push_back#define mp make_pair#define eps 1e-9#define zero(x) (fabs(x)<eps)#define pi acos(-1.0)

2014-09-12 14:45:57 348

原创 POJ 2187 凸包&旋转卡壳

#include #include #include #include #include #include #include #include #include #define pb push_back#define mp make_pair#define eps 1e-9#define zero(x) (fabs(x)<eps)#define pi acos(-1.0)

2014-09-11 20:59:16 413

原创 ##位运算若干应用##

//把右起第一个0变成1 | (100101111->100111111) | x or (x+1)//把右边连续的0变成1 | (11011000->11011111) | x or (x-1)//取右边连续的1 | (100101111->1111) | (x xor (x+1)) shr 1//取右起的第一个1 |

2014-09-09 22:12:40 359

转载 【转】ZOJ 3816 (伪数位dp+剪枝)||贪心

#include #include #include using namespace std;typedef long long LL;const int maxn = 50;int lim[maxn], len;LL num;void getlim(LL n) { memset(lim, 0, sizeof(lim)); len = 0; while (n

2014-09-08 16:26:58 403

原创 扩栈语句

G++:int size = 128 << 20; // 128MB char *p = (char*)malloc(size) + size; __asm__("movl %0, %%esp\n" :: "r"(p));C++:#pragma comment(linker, "/STACK:102400000,102400000")

2014-08-22 16:41:51 486

原创 生成树的计数

08年周冬的《生成树的计数及其应用》

2014-08-22 14:07:28 526

转载 【转】Cactus 仙人掌图 有向&无向

转自:http://blog.csdn.net/kksleric/article/details/7870398有向Cactus图:1.它是一个强连通图。2.它的任意一条边都属于且仅属于一个环。有向Cactus图判定:性质1 有向Cactus的DFS树没有横向边(不等价于非父子边)。性质2 low(u)是v的儿子)性质3 设某个点v有a(v)

2014-08-22 13:43:25 608

原创 ##TwoSet##

struct twoset{ int n; bool mark[N<<1]; int S[N<<1],c; vector g[N<<1]; bool dfs(int x) { if (mark[x^1]) return 0; if (mark[x]) return 1; mark[x]=1;

2014-08-20 16:00:27 419

原创 LA 4080 最短路好题

#include #include #include #include #include #include #include #include #include #define pb push_back#define mp make_pair#define eps 1e-9#define zero(x) (fabs(x)<eps)#define pi acos(-1.0)

2014-08-20 13:54:27 445

原创 hdu 4945 DP

//代码2:#include #include #include #include #include #include #include #include #include #include #include #include #define mp(x,y) make_pair(x,y)#define pb(x) push_back(x)#define sqr(x)

2014-08-15 17:26:19 394

原创 hdu 4933 孙子定理+数位dp

//code 1//dp[2][2]//mod 2520(9*8*7*5)//anss=anss%(anss%9);#include #include #include #include #include #include #include #include #include #define pb push_back#define mp make_pair#defin

2014-08-11 20:01:23 613

原创 hdu 4126

/*假设两个各自连通的部分分别为树A,树B1. 用dp[i][j]表示树A中的点i 到 树B(j点所在的树)的最近距离,这个过程可以在一边dfs就可以出来,对于每个 i 的dfs 复杂度是O(n) ,外加一个n的循环求出每个点,这里的总复杂度为 O(n^2)。2. 通过求出来的dp[i][j] 再用一个dfs 求出 树B 到 树A的最近距离,(方法:枚举树A中的所有点 到 树B的最近距

2014-08-09 20:35:09 428

原创 ##连通性##

struct edge{ int to,next,num; //增设num为判重边}e[M];void add(int x,int y,int m){ e[o].to=y; e[o].next=head[x]; e[o].num=m; head[x]=o++;}scanf("%d%d",&x,&y);{add(x,y,i); add(y,x,i)

2014-08-08 15:38:24 373

原创 hdu 4919 数论+大数

1、扩栈语句2、将递归转为非递归求解(标称这么做的)//f[n]=4f[k]+6k (n==2k+1)// =2f[k]+2[k-1]+4k-4 (n==2k)BigInteger contribution(const BigInteger &n, const BigInteger &coefficient) { BigInteger result; i

2014-08-06 14:53:38 528

vs2010的mpi

mpi link失败 如何解决 求 助

2014-11-17

空空如也

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

TA关注的人

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