摘要: disjkstra 算法View Code #include <iostream>#include <stdio.h>#include <string.h>using namespace std;int map[205][205];void inint(int n){ int i,j; for(i = 0;i < n;i++) for(j = 0;j < n;j++) if(i != j) map[i][j] = 0x5fffffff; else map[i][j] = 0;}//初始化~void Dijkstra(int s,int t,int 阅读全文
posted @ 2012-08-12 20:27 某某。 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Building a Space Station题目连接:http://poj.org/problem?id=2031没有什么难点,唯一要注意的是重复路径和相交的情况,但是前一点用克鲁斯基本可以无视~今天涨姿势了~PKU上用G++输出时printf不能用lf得用f以前有个好习惯都用f。。。View Code加一个prim的写法View Code #include <stdio.h>#include <string.h>#include <math.h>#define maxn 1000000struct node{ double x,y,z,r;}degre 阅读全文
posted @ 2012-08-12 15:22 某某。 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1698大意:先输入一个t代表有t个案例,然后输入个数n代表一共有n个数,值为他们的编号1~n。然后输入q,代表q各更新,再输入a,b,c,代表把a_b的值全部改为c;然后求出所有的和。View Code 1 #include <stdio.h> 2 #define maxn 100007*4 3 struct node 4 { 5 int sum; 6 int lazy; 7 }tr[maxn]; 8 void pushup(int rt) 9 {10 tr[rt].sum... 阅读全文
posted @ 2012-08-12 15:11 某某。 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://poj.org/problem?id=3468题目大意:输入N,和Q,代表n个数字和q个操作,然后输入n个数字,然后再输入q个操作,Q代表求询问a,b编号之间的和(包含),C代表把a,b,之间的数都加上c。代码:View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define maxn 100000*4+50 4 struct node 5 { 6 __int64 num; 7 __int64 lazy;//lazy标记 8 }tr[maxn]; 9 __int64 count;10 v 阅读全文
posted @ 2012-08-12 15:06 某某。 阅读(164) 评论(0) 推荐(0) 编辑