摘要:
做OJ的时候,做过类似的,即hash。算法很简单,关键是书上写的和做OJ,是完全不同的风格。有很多值得学习的地方。 /* * Table Lookup * 详见>(英文版*第二版) P143 * * This code is typical of what might be found in the symbl table * management routines of a macro processor or a compiler. * For example, consider the #define statment. When a line like * #define IN 阅读全文
posted @ 2013-08-09 23:46
Still_Raining
阅读(506)
评论(0)
推荐(0)
摘要:
题目链接。分析:手感不错,1A。直接穷举的起点, 求出不同起点到其它点最短路中最长的一条的最小值(好绕)。#include #include #include using namespace std;const int maxn = 100+20;const int INF = (1= d[y]) m = d[x=y]; vis[x] = true; for(int y=0; y d[x]+G[x][y]) { d[y] = d[x] + G[x][y]; } } int ans = -1; for(int i=... 阅读全文
posted @ 2013-08-09 17:29
Still_Raining
阅读(800)
评论(0)
推荐(0)
摘要:
题目链接。分析:以前没做出来,今天看了一遍题竟然直接A了。出乎意料。大意是这样,给定不同的金币的编号,以及他们之间的汇率、手续费,求有没有可能通过不断转换而盈利。直接用Bellman-ford检测负环的方法检测。#include #include #include using namespace std;const int maxn = 300;const int inf = (1d[e.v]) { d[e.v] = (d[e.u]-e.c)*e.r; } } } for(int i=0; id[e.v]) { ... 阅读全文
posted @ 2013-08-09 16:17
Still_Raining
阅读(201)
评论(0)
推荐(0)
浙公网安备 33010602011771号