- 博客(10)
- 收藏
- 关注
原创 HDU 1115 计算几何MB
#include #include #include using namespace std; #define N 1000005 struct point { double x,y; }p[N]; int T,n; double cal(point a,point b) { return (a.x-p[0].x)*(b.y-p[0].y)-(a.y-p[0].y)*(b.x
2013-06-07 18:05:53 428
原创 HDU 2653
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2653 题意(大意):一个Y要走到L去,‘.’可以飞也可以走,'@'必须飞,‘#’代表墙。给图的长宽和时间限制以及最初魔法值。飞的话走一步用1s消耗1魔法值,走的话用2s不耗魔法值。然后就是询问能不能给的时间内Y到L,相应输出。 思路:BFS+优先队列,vis标记数组第3维记录魔法值。 代码: #i
2013-05-27 22:00:52 405
原创 HDU 1547
DFS搜索水题 (链接:http://acm.hdu.edu.cn/showproblem.php?pid=1547) 题意:泡泡龙游戏,每个球最多直接连接6个球。输入给出图和newly球,newly球连接3个或3个以上相同颜色的球就会爆炸。第一次爆炸后没有直接或间接连接到第一行的球,也会爆炸。输出爆炸的球的数目。 思路:从newly球搜相同的球,搜完覆盖为空(E),然后从第一行搜连接在一起的
2013-05-24 17:31:55 819
原创 线段树成段更新-MB
链接:http://www.acm.uestc.edu.cn/problem.php?pid=1225&cid=211 #include #include using namespace std; struct node { int l,r; long long v,add; }a[4*
2013-05-24 16:31:18 426
原创 hdu1595(枚举+最短路(删掉任意一条边的最长最短路)-MB
#include #include #include #include #define MAX 1010 #define inf 0x3f3f3f using namespace std; struct node { int s,e; int val; int next; }a[MAX*MAX]; int n,m,ans; int start,end;
2013-05-24 12:55:06 665
原创 floyed(MB-经典求环)
#include #include #define N 105 #define inf (10000000) #include using namespace std; int mat[N][N],dis[N][N]; int m,n; int min(int a,int b) { return a } void Floyd() { int i,j
2013-05-24 12:53:36 537
原创 拓扑排序+并查集(MB hud 1811)
#include #include #include using namespace std; struct node { int val; int next; }a[20100]; int n,m; int used[10100],parent[10100]; int root[10100],ans,num; void init() { int i;
2013-05-24 12:51:39 513
原创 bellman_floyed(MB-回路加负环求最短路) hdu 1317
#include #include #include #include #define inf 0x3f3f3f using namespace std; int map[110][110],map1[110][110]; int value1[110]; int n,m; int flag[110]; int spfa() { int dis[110],i
2013-05-24 12:49:55 401
转载 MB--各种HASH
unsigned int SDBMHash(char *str) { unsigned int hash = 0; while (*str) { // equivalent to: hash = 65599*hash + (*str++); hash = (*str++) + (hash << 6) + (hash << 16) - hash; } return (hash
2013-05-22 22:15:15 480
原创 敌兵布阵 线段树初步练习【MB-单点更新线段树】
http://acm.hdu.edu.cn/showproblem.php?pid=1166 单点更新~毫无技术含量 #include #include int n; struct node { int l,r,ls,rs; int m; }tree[50000*3]; int root,p,t,tmp; void built(int &root,int l,int
2013-05-22 21:54:11 350
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人