
POJ
文章平均质量分 76
fyfcauc
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj-3295
#include #include #include struct operatorParam{ char operand; char operandRes; struct operatorParam * left; //For p q r s t and N, only one param. struct operatorParam原创 2014-06-02 14:34:47 · 630 阅读 · 0 评论 -
poj-1573
#include #include struct gridCell{ char direction; bool passed; int step;};typedef struct gridCell gridCell;typedef struct moveRecord moveRecord;void moveRobot(gridC原创 2014-06-03 11:33:31 · 580 阅读 · 0 评论 -
poj-2586
/* 题意: 对于每一个月来说,如果盈利则盈利S,如果亏空则亏d。每五个月进行一次统计,共统计八次(1-5月一次,2-6月一次.......) 统计的结果是这八次都是亏空。问题:判断全年是否能盈利,如果能则求出最大的盈利。如果不能盈利则输出Deficit MS公司每月要么盈余,要么亏损,且一年中每个月的盈余是一样的,亏损也是一样的。财务统计是每五个月统计一次收入总额,即1-原创 2014-06-02 09:10:29 · 775 阅读 · 0 评论 -
DP复习
重新复习了算法导论的DP一章:以前也看过, 不过那时候就是看, 基本没怎么用,现在回过头来再看,还是很多发现。根据求解子问题顺序的不同, 程序也会变为递归和迭代两种, 比如 a[i, k](k == 1 || k ==2, k依赖于每一步的选择空间有几个) 的结果依赖于 a[i-1, 1] 和 a[i-1, 2]。如果是顺序的从 i = 0 开始求, 那么就是迭代。如果是逆序的原创 2014-06-04 10:19:07 · 509 阅读 · 0 评论 -
poj-2593
#include #include int getMaxSum(int *array, int beginPos, int endPos, int *dpArray) { int MaxBegin = beginPos; int MaxEnd = beginPos; int curMax = array[beginPos]; int curMax原创 2014-06-03 20:55:43 · 588 阅读 · 0 评论 -
poj-3432
#include #include #include #include struct pointInfo { int x; int y; int havl; struct pointInfo * next;};struct point { int x; int y;};typedef struc原创 2014-06-23 20:58:36 · 526 阅读 · 0 评论 -
poj-3041
//1380K 47MS G++#include #include #define MAX 510int N;int K;int Vset1[MAX]; // rowint Vset2[MAX]; // columnint G[MAX][MAX]; // 0: no asteriod, 1: asteriodint assignedFlag[MAX];int waitin原创 2014-07-13 18:28:08 · 417 阅读 · 0 评论 -
poj-2446
#include #include #define MAX 35#define GRID_MAX MAX*MAXint G[MAX][MAX];char G_relation[GRID_MAX][GRID_MAX];int M; // lengthint N; // heightint K;int validGridNum;int V1[GRID原创 2014-07-15 17:56:37 · 573 阅读 · 0 评论 -
poj-2002
#include #include #include struct pointInfo { int x; int y; int havl; char used; char usedAsSquare;};struct point { int x; int y;};typedef struct原创 2014-06-23 20:25:46 · 528 阅读 · 0 评论 -
最小边覆盖与最小路径覆盖的联系与区别
From: http://blog.youkuaiyun.com/wall_f/article/details/8187144鉴于我一直没有分清楚最小边覆盖与最小路径覆盖的关系,于是我就写写总结。边覆盖集:通俗地讲,所谓边覆盖集,就是G中所有的顶点都是E*中某条边的邻接顶点(边覆盖顶点),一条边只能覆盖2个顶点。注意:在无向图中存在用尽量少的边去“覆盖”住所有的顶点,所以边覆盖集有极小与最小的转载 2014-07-16 12:04:49 · 639 阅读 · 0 评论 -
poj-1422
//440K 0MS G++#include #include #define MAX 125int G[MAX][MAX];int iNum;int sNum;int V1[MAX];int V2[MAX];char waitingMove[MAX];char getPair(int checkId) { for (int i = 1; i <= iNum原创 2014-07-16 11:51:26 · 532 阅读 · 0 评论 -
poj-3253
#include #include #include using namespace std;priority_queue, greater > intQueue;void getMinCost() { long long totalCost = 0; while(intQueue.size() > 1) { long long原创 2014-06-24 14:45:40 · 524 阅读 · 0 评论 -
poj-1273
// 936K 32MS G++#include #include #include #define MAX 210#define INF 999999long long intersectionMap[MAX][MAX];int prev[MAX];int flow[MAX];int N;int M; // intersection numusing原创 2014-07-17 14:15:04 · 593 阅读 · 0 评论 -
poj-2503
#include #include #include #include #include #include using namespace std;struct dict_entry{ int hval; char foreign[15]; char local[15]; struct dict_entry * next;原创 2014-06-24 10:07:44 · 516 阅读 · 0 评论 -
二分图带权匹配 KM算法与费用流模型建立
From: https://www.byvoid.com/blog/match-km/[二分图带权匹配与最佳匹配]什么是二分图的带权匹配?二分图的带权匹配就是求出一个匹配集合,使得集合中边的权值之和最大或最小。而二分图的最佳匹配则一定为完备匹配,在此基础上,才要求匹配的边权值之和最大或最小。二分图的带权匹配与最佳匹配不等价,也不互相包含。我们可以使用KM算法实现求二分图的最转载 2014-07-16 20:18:35 · 660 阅读 · 0 评论 -
poj-2001
#include #include #include #include #include #include using namespace std;const int CHAR_NUM = 26;struct tireNode{ char val[22]; struct tireNode * tireChildNode[CHAR_NU原创 2014-06-25 17:04:36 · 590 阅读 · 1 评论 -
poj-3630
#include // #include #include // #include // #include #include #define CHAR_NUM 10#define STATIC_CAP 700000struct tireNode{ int childPos[CHAR_NUM]; int appearTime;原创 2014-06-25 14:33:08 · 398 阅读 · 0 评论 -
poj-2594
// 2712K 266MS G++ #include #include #include using namespace std;#define MAX 520int G[MAX][MAX];int G_F[MAX][MAX];int iNum;int sNum;int V1[MAX];int V2[MAX];char waitingMove[MAX];原创 2014-07-16 17:14:04 · 520 阅读 · 0 评论 -
poj-1442
#include #include #include #define HEAP_SIZE 30010template class Less {public: char operator()(const T & p1, const T & p2) const { return p1 }};template cla原创 2014-06-26 10:45:15 · 555 阅读 · 0 评论 -
poj-1200
#include #include #include #define MAX_SUBSTRING_NUM 1600000#define BIG_PRIME 1000007#define MAX_N 25char baseString[3000000];struct NodeInfo{ char val[MAX_N]; int next;}原创 2014-06-26 20:40:07 · 560 阅读 · 0 评论 -
poj-1042
#include #include struct fishingOP { int maxFishing; int stayInterval;};typedef struct fishingOP fishingOP;void getMostFish(int * fi, int * di, int * ti, int lakeNum, int i原创 2014-06-07 21:59:29 · 656 阅读 · 0 评论 -
poj-3664
#include #include #include using namespace std;#define COW_NUM 50000class cow_vote {public: int index; long Avote; long Bvote; void operator=(const cow_vote & p)原创 2014-06-26 15:34:24 · 541 阅读 · 0 评论 -
poj-1011
#include #include #include #include using namespace std;int tmpArray[300];int sticks[64];char stickUsed[64];int maxLevel;int comp( const void *a, const void * b){return *原创 2014-06-28 11:06:23 · 560 阅读 · 0 评论 -
poj-1080
#include #include int alignmentMatix[100][100] = {0};int DPResult[101][101];void init() { alignmentMatix['A']['A'] = 5; alignmentMatix['A']['C'] = -1; alignmentMatix['A']['G原创 2014-06-08 20:15:32 · 631 阅读 · 0 评论 -
poj-2195
#include #include #include using namespace std;#define MAX 110int map[MAX][MAX]; // 0: space, even: human odd: houseint N; // number of rows, heightint M; // number of columns. widthstruc原创 2014-07-18 17:34:24 · 628 阅读 · 0 评论 -
poj-1050
#include int getArrayMaxSum(int *Array, int length) { // printf("======================================\n"); // for (int i = 0; i // printf("%d ", Array[i]); // }原创 2014-06-08 15:59:26 · 441 阅读 · 0 评论 -
poj-1260
#include #include struct pearlInfo{ int number; int price;};typedef struct pearlInfo pearlInfo;struct BuyOP { int cost; int higerGlass;};typedef struct BuyO原创 2014-06-10 10:42:07 · 422 阅读 · 0 评论 -
poj-3083
// 700K 0MS G++#include #include #include using namespace std;#define MAX 50char maze[MAX][MAX];char leftFirst[2] = {-1, 1};char rightFirst[2] = {1, -1};struct Point { int x; int y; i原创 2014-07-20 15:27:51 · 604 阅读 · 0 评论 -
poj-3278
// 1152K 47MS G++#include #include #include #define MAX 100001using namespace std;struct Pos { int x; int time;};typedef struct Pos Pos;queue BFSQueue;int Bx;int Ex;in原创 2014-07-21 13:21:56 · 564 阅读 · 0 评论 -
poj-1221
#include int UnimodalNum[1000][1000] = {0};void init() { for(int i = 0; i for (int j = 999; j >= 0; j--) { if (i == 0) { // N is 0. UnimodalNum[原创 2014-06-09 18:24:37 · 490 阅读 · 0 评论 -
poj-3009
//376K 172MS G++#include #include #define MAX 30int W;int H;int board[MAX][MAX];int Sx;int Sy;int Gx;int Gy;#define INF 99999int dfs(int curX, int curY, int throwTime) { int minThr原创 2014-07-20 20:11:57 · 560 阅读 · 0 评论 -
poj-1260
#include #include struct pearlInfo{ int number; int price;};typedef struct pearlInfo pearlInfo; struct BuyOP { int cost; int higerGlass;};typedef struct Buy原创 2014-06-09 22:20:05 · 399 阅读 · 0 评论 -
poj-2251
//788K 0MS G++#include #include #include #define MAX 50using namespace std;char maze[MAX][MAX][MAX]; // z , y, xstruct Pos { int x; int y; int z; int time;};typedef struc原创 2014-07-21 11:16:40 · 482 阅读 · 0 评论 -
poj-1087
// 2604K 32MS G++ #include #include #include #include #include using namespace std;#define MAX 230map deviceList;int receptacleNum;int deviceNum;int adapterNum;struct flowNode { int原创 2014-07-19 15:42:51 · 676 阅读 · 0 评论 -
poj-2488
//376K 16MS G++#include #include #define MAX 28 int board[MAX][MAX];int p;int q;struct Point{ int x; int y;};typedef struct Point Point;Point visitOrder[MAX];int visitedSquareNum;in原创 2014-07-19 22:28:51 · 446 阅读 · 0 评论 -
poj-1321
// 376K 16MS G++#include #include #define MAX 10char occupiedColumn[MAX];char occupiedRow[MAX];char board[MAX][MAX];int W;int H;int chessNum;#define INF 99999int dfs(int rowId, int原创 2014-07-21 10:24:04 · 508 阅读 · 0 评论 -
POJ 3299
#include #include double eForExp = 2.718281828;double getT(double D, double H) { double h = 0.5555 * (6.11 * pow(eForExp, (5417.7530 * ((1/273.16) - (1/(D + 273.16))))) - 10.0); pr原创 2014-05-27 13:41:18 · 432 阅读 · 0 评论 -
poj-1129
//372K 0MS G++#include #include #include #define BEGIN 'A'int graph[26][26];int repeaterUsingChannel[26];int channelUsedInfo[27]; // channel 1 ~ 27int totalChanne原创 2014-06-29 19:35:43 · 545 阅读 · 0 评论 -
poj-2513
// 1st AC 30052K 4313MS G++#include // #include #include #include #include using namespace std;const int CHAR_NUM = 26;struct tireNode { // char val[20]; int tireChil原创 2014-06-30 20:59:35 · 441 阅读 · 0 评论 -
并查集(Union-Find)算法介绍
from http://blog.youkuaiyun.com/dm_vincent/article/details/7655764本文主要介绍解决动态连通性一类问题的一种算法,使用到了一种叫做并查集的数据结构,称为Union-Find。更多的信息可以参考Algorithms 一书的Section 1.5,实际上本文也就是基于它的一篇读后感吧。原文中更多的是给出一些结论,我尝试给出转载 2014-06-30 09:49:35 · 416 阅读 · 0 评论