ACM算法
excellent_mmm
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
spfa组长版本!
#include #include #include #include using namespace std; const int maxn = 10010; typedef long long ll; const ll INF = 1e18; struct Side{ int to,next; ll w; }side[50010]; int top; int node[maxn原创 2014-04-04 16:58:06 · 693 阅读 · 0 评论 -
hdu2544
Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? #include #include #include #include #include using namespace std; #defi原创 2014-03-08 12:41:09 · 504 阅读 · 0 评论 -
poj1002
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 230413 Accepted: 40219 Description 企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你需要给滑铁卢大学打电话原创 2014-03-05 20:19:01 · 564 阅读 · 0 评论 -
hdu1002
就是求两个很大位数的数的和,测试数据会暴int和long long,所以只能用字符数组存数,并一位一位相加喽#include #include int main() { char a[1000],b[1000],c[1000];//创建三个数组,c数组用于存结果 int t,i; scanf("%d",&t); for(i=0;i<t;i++) {原创 2014-03-05 20:01:01 · 1820 阅读 · 0 评论 -
最短路SPFA算法
明天学习KMP 和 SPFA 还有floyd 算法 熟悉一下原创 2014-03-29 12:26:16 · 759 阅读 · 0 评论 -
poj2488
Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two原创 2014-03-16 12:39:05 · 832 阅读 · 0 评论 -
最短路kruskal算法
今天刚讲了下并查集原创 2014-03-23 20:19:31 · 939 阅读 · 0 评论 -
Floyd算法
o(n的立方)算法 求任意两点之间的最短路 //任意两点之间的最短路 #include #include #include #include #include using namespace std; const int Max=11000; const int INF=1000001; int g[Max][Max]; int main() { int i,j; int n,m原创 2014-03-25 14:53:22 · 707 阅读 · 0 评论 -
poj3414
恩,首先解释题意啦,啦啦啦,给你两个容器容量分别是A,B,可以对A,B两个锅进行三个操作, 1:FILL(i)把i锅装满 2:DROP(i)把i锅的水倒空 3:POUR(i,j)把i锅的水倒入j锅,直到j锅装满 然后如果能把A或者B装成C的容量则打印最短步骤,否则打印‘impossible’; 思路:一看就是bfs题了,求最短啥的一般都用bfs,做这种题一定 要注意的是状态标记与状态转原创 2014-03-04 23:09:26 · 653 阅读 · 0 评论 -
poj2387
Description Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she w原创 2014-03-09 09:33:14 · 633 阅读 · 0 评论 -
最小生成数模板
int prim() { //low数组用来保存非生成树中各顶点与生成树中顶点最短边的权值;dis数组则是你输入的数组矩阵 int ans = 0, i, j, flag, min; //ans用来存放最小生成树的总权值 for(i = 1; i <= n; ++i) { low[i] = dis[1][i];//原创 2014-03-09 12:39:27 · 560 阅读 · 0 评论 -
poj2386
明天要周赛了,考bfs和dfs 练练手原创 2014-03-15 15:16:18 · 815 阅读 · 0 评论 -
poj1111
Image Perimeters Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7380 Accepted: 4396 Description Technicians in a pathology lab analyze digitized images of s原创 2014-03-05 20:57:23 · 644 阅读 · 0 评论 -
poj1065
Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17154 Accepted: 7179 Description There is a pile of n wooden sticks. The length and weight of e原创 2014-03-05 20:41:19 · 614 阅读 · 0 评论 -
最短路模板(dijstra)
#define INF 0Xfffffff const int Max=1000000; int map[Max][Max]; int dis[Max]; bool vis[Max]; void dijstra() { memset(vis,false,sizeof(vis)); int i,j,mark_num,temp; for(i=1;i<=n;i++) {原创 2014-03-10 16:04:53 · 618 阅读 · 0 评论 -
poj3085
大致题意:给你四种金币数额,0.25,0.1,0.05,0.01 ,让你用最少数量的金币,使金币和等于给定金币N(每种金币可以用任意数量).哎呀,人家第一道是水题,别见怪哦~原创 2014-03-04 21:21:23 · 758 阅读 · 0 评论 -
LA4329
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4174 考虑第i个人当裁判的情形。假设从a1到ai-1有ci个人比ai小,那么就有(i-1)-ci个比ai大。di同理。 根据乘法原理和加法原理,i当裁判时有ci(n-i-di)+di(原创 2014-08-12 10:43:05 · 719 阅读 · 0 评论 -
hdu1874
某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input 本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(0 接下来是M行道路原创 2014-03-18 18:55:02 · 789 阅读 · 0 评论 -
朴素模式串匹配
最大时间复杂度为|P|(|T|-|P|+1)次 #include #include #include #include #include #include #include using namespace std; int match(string T,string P)//返回目标串与模式串完全匹配的第i个位置 { int p=0; int t=0; int plen=原创 2014-03-14 16:13:01 · 668 阅读 · 0 评论 -
hdu1102
Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connec原创 2014-03-09 23:16:30 · 797 阅读 · 0 评论
分享