- 博客(21)
- 资源 (6)
- 收藏
- 关注
原创 poj 3177 双连通分量+缩点
DescriptionIn order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten
2016-05-31 10:22:43 472
原创 割点和桥问题 poj1144模板题
DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the same number. The
2016-05-30 17:29:50 879
原创 蓝桥杯 (小朋友排队)树状数组求逆元
历届试题 小朋友排队 时间限制:1.0s 内存限制:256.0MB 问题描述 n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。 每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。 如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他
2016-05-25 20:30:04 508
原创 hdu 斜率dp
Problem DescriptionZero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to work for a long time and it will certai
2016-05-24 21:08:35 441
原创 hdu 2516 (斐波那契数列)
Problem Description1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍。取完者胜.先取者负输出"Second win".先取者胜输出"First win". Input输入有多组.每组第1行是2 Output先取者负输出"Second win".
2016-05-23 22:51:33 457
原创 poj 1330(最近公共祖先)
DescriptionA rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an integer from {1, 2,...,16}.
2016-05-23 21:09:35 617
原创 常用数学函数
math.h 数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有: 1 三角函数 double sin (double); double cos (double); double tan (double); 2 反三角函数 double asin (double); 结果介于[-PI/2, PI/2] double acos (double); 结果介
2016-05-23 18:27:56 320
原创 染色问题(n个格子,3种颜色)
有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.递推公式:A1 = 3A2 = 6 //A(3,2)=6A3 = 6 //A(3,3)=6An=2*A(n-2)+A(n-1), n>=4证明:考虑第n-1个格子:1. 如果这个格子
2016-05-23 16:25:21 8381
原创 sdut 2878 Circle (求期望+高斯消元求解)
题目描述You have been given a circle from 0 to n - 1. If you are currently at x, you will move to (x - 1) mod n or (x + 1) mod n with equal probability. Now we want to know the expected number of steps
2016-05-20 22:24:42 593
原创 后缀数组 相关问题模板
后缀数组函数模板:const int MAX=200020;int wa[MAX],wb[MAX],wsf[MAX],wv[MAX],sa[MAX];int rank[MAX],height[MAX],r[MAX];string str1,str2;int cmp(int *r,int a,int b,int k){ return (r[a]==r[b])&&(r[a+k]=
2016-05-18 20:46:28 368
原创 hdu 1116 (有向欧拉图) 欧拉图问题
通过图中所有边1次且仅1次行遍所有顶点的通路称作欧拉通路。通过图中所有边1次且仅1次行遍所有顶点的回路称作欧拉回路。具有欧拉回路的图称为欧拉图。具有欧拉通路而无欧拉回路的图成为半欧拉图。无向图:G是欧拉图当且仅当G是是连通图且没有奇度顶点G是半欧拉图当且仅当G是连通图恰有2个奇度顶点有向图:(求有向图是否连通只需要把有向图看作无向图来处理连通性即可)D是欧拉图当且仅
2016-05-16 17:32:52 1158
原创 大数深搜
DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater t
2016-05-15 15:03:58 375
原创 hdu 欧拉回路(判断)
通过图中所有边1次且仅1次行遍所有顶点的通路称作欧拉通路。通过图中所有边1次且仅1次行遍所有顶点的回路称作欧拉回路。具有欧拉回路的图称为欧拉图。具有欧拉通路而无欧拉回路的图成为半欧拉图。无向图:G是欧拉图当且仅当G是是连通图且没有奇度顶点G是半欧拉图当且仅当G是连通图恰有2个奇度顶点有向图:D是欧拉图当且仅当D是强连通且每个顶点的入度等于出度。P
2016-05-14 21:56:53 717
原创 半平面交 poj 3335(判断是否有内核) poj 3525 (半平面交+二分)
poj 3335DescriptionThis year, ACM/ICPC World finals will be held in a hall in form of a simple polygon. The coaches and spectators are seated along the edges of the polygon. We want to p
2016-05-13 20:18:26 494
原创 hdu 2851 dijkstra算法变形
dijkstra算法模板:Int visited[i]//结点i若被访问则为1,没有则为0Int dist[i]// 目前结点j到其他各结点的最短路的长度Int w[i][j]//边(i,j)的权值初始化:(结点1~n)memset(v,0,sizeof(v));dist[j]=0;dist[i]=inf;(i>=1&&i<=n&&i!=j) cin>>a>>b>>x;
2016-05-09 20:53:01 873
原创 poj 3067 poj 2481 树状数组变形+对区间排序
这种问题先对区间和线段进行排序,排序方法见代码cmp然后分析其中一个点,用sum求值poj 3067DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tal
2016-05-09 19:34:14 1080
原创 poj 2318 叉积的应用+二分
DescriptionCalculate the number of toys that land in each bin of a partitioned toy box.Mom and dad have a problem - their child John never puts his toys away when he is finished playing with t
2016-05-07 23:55:53 2697
原创 poj 1654 在方格中求多边形的面积
DescriptionYou are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step
2016-05-07 19:34:08 775
原创 二维凸包
二维凸包模板p[1010]//输入的点集,res[1010]//输出的点集int n;//点的个数int cmp(Point a,Point b)//先对x坐标排序,在比较y坐标{ if(a.x==b.x) return a.y<b.y; return a.x<b.x;}int ConvexHull()//返回凸包顶点数{ sort(p,p+
2016-05-06 23:30:10 2139
原创 hdu 2444 是否是二分图+二分图最大匹配数
Problem DescriptionThere are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. But this may not imply that A a
2016-05-03 21:01:42 409
原创 poj 2352 hdu 2642 hdu 1556 poj 2155 树状数组
二维树状数组模板int lowbit(int x){ return x&(-x);}void add(int x,int y,int val)//a[x][y]增加val{ for(int i=x;i<=n;i+=lowbit(i)) for(int j=y;j<=n;j+=lowbit(j)) c[i][j]+=val;}int getsum(int x,i
2016-05-02 22:10:01 539
2016年国科大NLP(自然语言处理)期末考试题-宗老师
2019-07-07
360断网急救箱独立版
2018-04-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人