自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(95)
  • 资源 (2)
  • 收藏
  • 关注

转载 树链剖分模板题

1036: [ZJOI2008]树的统计CountTime Limit: 10 Sec  Memory Limit: 162 MBSubmit: 3401  Solved: 1418[Submit][Status]Description一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t

2015-07-24 14:15:31 545

转载 Max_Flow dinic

BeiJing2006 狼抓兔子#include#include#define MAXD 1000100#define MAXM 6000600#define INF 1000000000int N, M, T, e, first[MAXD], next[MAXM], u[MAXM], v[MAXM], flow[MAXM];int q[MAXD], d[MAXD], work[MAX

2015-07-24 10:00:27 441

原创 Dijkstra with priority queue

POJ 1511 Invitation Cards(单源最短路,优先队列优化的Dijkstra)

2015-07-23 20:12:35 553

原创 hash值的计算与转换

#include using namespace std;const int MAXN = 100;const int X = 3;long long f[1005];void init() { f[0] = 1; for(int i = 1;i < MAXN; i++) { f[i] = f[i-1]*X; } } int

2015-05-07 17:49:34 9316

原创 NYOJ - 35 表达式求值

#include#include#include#includeusing namespace std;stacksn;stacksc; double num, des, dou; bool prt, flag; int t, len; string str;bool isNum(char c){ if(c >= '0' && c <= '9') return tru

2015-03-18 10:33:07 658

原创 进制转换函数

long fun(string str, int x) { int i,t; long sum=0; for(i = 0; str[i]; i++) { if(str[i] <= '9') t = str[i] - '0'; else t = str[i] - 'A' + 10; sum = sum * x + t; }

2015-02-15 09:41:11 730

转载 操作系统图解

重读William Stallings的Operating System的个人总结,未涉及安全和分布式部分(这部分在英文版中被阉割了)。上一张完成的大图,然后再慢慢画起(在每个图后面加链接看大图)。另外这里只是简单的知识点罗列,同样发布了一篇完整的(2w字,还没来得及校对)总结,欢迎查看。大图    计算机组成     先从最简单的开画,这里计算机的组成员工就三层:应用

2015-02-03 23:44:28 1005

原创 Bzoj 1036 树的统计

Description一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身Input

2014-12-29 18:55:07 612

转载 关于C++ const 的全面总结

C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。 一、Const作用  如下表所示:No.作用说

2014-12-03 21:03:19 435

原创 NYOJ-109 数列转换 AC

守恒法的问题,表示,刚刚看了一点点#include #include #include #include using namespace std;int main(){ int T, n; bool flag; int num[10005]; int ans[10005]; int sux[10005]; int sum[10005]; cin>>T; while(

2014-12-01 00:54:19 671

转载 NYOJ 119 士兵杀敌(三)【ST算法】

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=119解题思路:RMQ算法。不会的可以去看看我总结的RMQ算法。http://blog.csdn.net/niushuai666/article/details/6624672代码如下:#include#include#includeusing

2014-11-13 20:56:00 578

转载 Poj 2559 最大矩形面积 v单调栈

#include#include#includeusing namespace std;struct node{ __int64 num,pre,next;};int main(){ int n; freopen("in.txt","r",stdin); while(scanf("%d",&n)>0&&n) { stackQ

2014-11-13 20:48:31 592

转载 bzoj 1041 圆上的整点

这里先只考虑x,y都大于0的情况如果x^2+y^2=r^2,则(r-x)(r+x)=y*y令d=gcd(r-x,r+x),r-x=d*u^2,r+x=d*v^2,显然有gcd(u,v)=1且u有2r=d*(u^2+v^2),y=d*u*v,x=d(v^2-u^2)/2枚举2r的约数d,再花费sqrt(2r/d)的时间枚举u,求出v=sqrt(2r/d-u^2)然后判

2014-11-11 20:15:25 522

转载 Hdu 1506 Largest Rectangle in a Histogram

Largest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11706    Accepted Submission(s): 3219Problem Descripti

2014-10-28 19:16:19 525

原创 cf 61E. Enemy is weak 树状数组求逆序数(WA)

#include #include #include #include #include #include #include using namespace std;long long num[1000005];long long fz[1000005];long long xds[1000005];long long qs[100005];long long hs[100

2014-10-19 15:16:20 709

原创 Least Common Ancestors

#include #include #include #include #include using namespace std;struct node{ int f, s;};vectorimap[40005];int deep[40005];int dis[40005];int fa[40005];int ffa[40005];bool vis[40005];v

2014-10-19 11:24:45 528

原创 Codeforce 438D-The Child and Sequence

D. The Child and Sequencetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt the children's day, the child

2014-10-06 20:20:56 574

原创 Codeforces 343D Water Tree

D. Water Treetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMad scientist Mike has constructed a rooted tree, which

2014-10-05 14:38:00 559

原创 二分图匹配(KM算法)n^4

#include #include#include#include#includeusing namespace std; int g[505][505]; int dx[505],dy[505];bool vx[505], vy[505];int dis[505]; int n, x, y; int res, minn;bool find(int u){

2014-10-04 11:36:27 598

原创 二分图匹配(KM算法)n^3

#include #include#include#includeconst int maxn = 301;const int INF = (1<<31)-1;int w[maxn][maxn];int lx[maxn],ly[maxn]; //顶标int linky[maxn];int visx[maxn],visy[maxn];int slack[maxn];int

2014-10-01 21:46:22 1445

原创 二分图匹配

#include#includeusing namespace std;bool map[505][505];int n, k;bool vis[505];int linker[505];void sscanf(){ int x, y; scanf("%d%d",&n,&k); for(int i=1;i<=k;i++) { scanf("%d%d",&x,&y);

2014-10-01 19:57:34 434

转载 好用到没朋友的大数模板(c++)

#include #include using namespace std; #define DIGIT 4 //四位隔开,即万进制 #define DEPTH 10000 //万进制 #define MAX 2251 //题目最大位数/4,要不大直接设为最大位数也行 typedef int bi

2014-10-01 15:06:02 635

原创 Beautiful People

Beautiful PeopleTime Limit: 10000/5000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)     Special JudgeSubmitStatusProblem Description      The most prestigious sports cl

2014-10-01 14:33:47 544

原创 max_flow(Dinic)

#include #include #include #include #include using namespace std; const int INF = 0x3fffffff; int g[1005][1005]; int pre[1005]; int m; int bfs(int s,int

2014-09-02 15:42:28 476

原创 max_flow(Edmond_Karp)

#include #include #include #include using namespace std; const int INF = 0x3fffffff; int g[1005][1005]; bool vis[1005]; int m; int Edmond_Karp(int s,int t)

2014-09-02 10:47:29 466

原创 max_flow(Ford-Fulkerson)

#include #include #include #includeusing namespace std;const int INF = 0x3fffffff;int g[1005][1005];bool vis[1005];int m;int Ford(int s,int t,int f){ if(s==t) return f; for(in

2014-09-02 01:50:55 605

原创 short-path problem (Spfa)

#include #include #include #includeusing namespace std;const int INF = 0x3fffffff;int g[1005][1005];int m;int Spfa(int s,int t){ queueq; int dis[1005]; for(int i=1;i<=m;i++)

2014-09-02 00:30:46 543

原创 short-path problem (Floyd)

#include #include #include using namespace std;const int INF = 0x3fffffff;int g[1005][1005];int m;void Floyd(){ int i, j, k; for (k=1;k<=m;k++) { for (i=1;i<=m;i++)

2014-09-01 23:58:23 591

原创 short-path problem (Dijkstra)

#include #include #include using namespace std;const int INF = 0x3fffffff;int g[1005][1005];int m;int Dijkstra(int s,int t){ bool visit[1005]; int dis[1005]; for(int i = 1; i <

2014-09-01 23:51:30 640

原创 Binary Indexed Tree 2D

#include #include #include #include #include using namespace std; int map[1015][1015]; void update(int x,int y, int n) { for(int i=x;i<=1005;i+=(i&(-i)))

2014-09-01 08:40:31 509

转载 博弈论入门小结

转载博弈论:是二人或多人在平等的对局中各自利用对方的策略变换自己的对抗策略,达到取胜目标的理论。博弈论是研究互动决策的理论。博弈可以分析自己与对手的利弊关系,从而确立自己在博弈中的优势,因此有不少博弈理论,可以帮助对弈者分析局势,从而采取相应策略,最终达到取胜的目的。博弈论分类:(摘自百度百科)(一)巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规

2014-08-31 10:15:09 510

原创 快速幂取模

#include #include //快速幂算法,数论二分 long long powermod(int a,int b, int c) //不用longlong就报错,题目中那个取值范围不就在2的31次方内 { long long t; if(b==0) return 1%c; if(b==1) return a%c; t=

2014-08-29 22:01:04 474

原创 Binary Indexed Tree

#include#include#includeusing namespace std;int n, m;int num[100005];int front(int x){ return x&(-x);}int update(int x,int k){ do { num[x]+=k; x-=front(x); }

2014-08-29 13:08:25 491

原创 Segment Tree 扫描线

#include#include#include #define Max 1005using namespace std;struct line{ double x, y1, y2; int flag;}x_line[Max];struct node{ int l, r, flag; double x, f;}tree[Max];double point[Max];

2014-08-29 13:08:03 510

原创 Segment Tree

#include#includeusing namespace std;struct node{    int l, r, m;    int max;}num[800005];int val[200005];int n, m;int init(int l, int r, int k){    num[k].l = l;    num[k].r

2014-08-29 13:04:55 447

原创 Segment Tree with Lazy

#include#include#includeusing namespace std;struct node{ int l, r, s;}num[800005];int n, m, key;void build(int l,int r,int k){ num[k].l = l; num[k].r = r; num[k].s = 0; if

2014-08-29 11:28:28 660

转载 8大排序算法图文讲解

排序算法可以分为内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。常见的内部排序算法有:插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。本文将依次介绍上述八大排序算法。算法一:插入排序 插入排序示意图插入排序是一种最简单直观的排序算法,它的工作原理是

2014-08-18 11:49:35 476

转载 JAVA swing中JPanel如何实现分组框的效果以及设置边框颜色

代码如下:import java.awt.FlowLayout;import java.awt.Frame;import java.awt.GridLayout;import javax.swing.BorderFactory;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JF

2014-08-16 12:21:55 9759

转载 java 解决JFrame不能设置背景色的问题

这段时间比较多,于是写一写JAVA的一些IT技术文章。如有JAVA高手请加QQ:314783246,互相讨论。   在Java的GUI设计中,Frame和JFrame两者之间有很大差别,上次刚学时编一个窗口老是出现不能设置背景色的问题,最后通过不断将一些代码注释掉的办法查出是JFrame类的问题。   看下面代码:import java.lang.*;import java.awt

2014-08-15 09:48:10 2026

转载 Java 函数参数传递方式详解

转:http://zzproc.iteye.com/blog/1328591在阅读本文之前,根据自己的经验和理解,大家可以先思考并选择一下Java函数的参数传递方式: A. 是按值传递的? B. 按引用传递的? C. 部分按值部分按引用? 此处暂不宣布正确答案,我们通过一个简单的例子让大家自己找答案: 1. 先定义一个类型Value Java代码  

2014-08-15 06:34:28 573

网络互联技术(2014)慕课课件

网络互联技术(2014)慕课课件,此为慕课的所有课件,up主为复习而下,

2014-08-03

VB获取QQ好友列表

通过协议来获取QQ好友,并且登录QQ空间,虽然只是初步,但可以自己改造成个性的程序

2013-07-04

空空如也

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

TA关注的人

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