![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
----------POJ----------
文章平均质量分 54
xmzyt1996
这个作者很懒,什么都没留下…
展开
-
【POJ 1852】 Ants
Description An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it immediatelly falls off it. When two ants原创 2015-02-20 17:11:21 · 365 阅读 · 0 评论 -
POJ 1056 IMMEDIATE DECODABILITY // Trie
题目描述POJ 1056 IMMEDIATE DECODABILITY解题思路思路同 POJ 3630 Phone List参考代码//**********************************************// Author: @xmzyt1996// Date: 2015-10-16// Name: POJ 1056.cpp//*************原创 2015-10-26 22:27:04 · 265 阅读 · 0 评论 -
POJ 1204 Word Puzzles // 字典树,枚举, 搜索
题目描述POJ 1204 Word Puzzles解题思路题目大意: 给出一个Word Puzzles,然后询问每个单词在其中出现的坐标(i, j, dir) i 为单词首字母的横坐标 ,j为纵坐标,dir为八方向之一(用A~H表示)这题我一开始是将Word Puzzles所有可能的单词建Trie,然后每个单词维护(i,j,dir)的信息,这样的话时间和空间的消耗都特别巨大,因此应该换一个思路。原创 2015-10-26 23:26:34 · 427 阅读 · 0 评论 -
POJ 3630 Phone List // Trie
题目描述POJ 3630 Phone List解题思路题目大意: 给一些电话号码,只要存在其中一个号码是另一个号码的前缀,输出“NO”,否则输出“YES”。将n个号码插入字典树中,对每个节点维护有多少个号码经过此节点,然后再遍历n个号码,判断前缀是否唯一。参考代码#include <stdio.h>#include <string.h>#include <stdlib.h>struct Tr原创 2015-10-25 23:00:48 · 346 阅读 · 0 评论 -
POJ 2503 Babelfish // 字符串映射,Trie
题目描述POJ 2503 Babelfish解题思路题目大意: 给一些单词A及其对应的单词B,比如 dog -> ogday, 然后再输入单词B,输出单词A,若输入的B不存在映射,则输出”eh“.用STL的map应该可以水过去,但是还是用Trie实现一下~~参考代码//**********************************************// Author: @xmzyt原创 2015-10-25 23:12:04 · 305 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers // 线段树 区间更新
题目描述POJ 3468 A Simple Problem with Integers解题思路题目大意: 对给定的一段区间支持下列操作: 1) 对区间[l, r] 的所有数, 增加(或减少)某个值 2) 查询区间[l, r] 的和 线段树成段更新的类型题, 具体看注释~^ ^参考代码#include <stdio.h>#define lson rt<<1#define rson rt<<原创 2015-08-16 22:51:18 · 322 阅读 · 0 评论 -
POJ 1125 Stockbroker Grapevine //Floyd算法
题目描述POJ1125 Stockbroker Grapevine解题思路找出一个人,使谣言从其传出到所有人用时最短. (1):用Floyd先算出某人到每个人的最短时间,再对时间取最大 (保证每个人都能收到谣言…) = =| (2):对每个人执行(1),取时间最小,即为所求.参考代码#include <iostream>#include <algorithm>#include <cstdio原创 2015-07-15 21:00:22 · 281 阅读 · 0 评论 -
POJ 3615 Cow Hurdles //Floyd算法
题目描述POJ3615 Cow Hurdles解题思路核心代码: f[i][j] = min(f[i][j],max(f[i][k],f[k][j]));参考代码#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#define inf 0x3f3f3f3f#define MAX_V 310u原创 2015-07-15 21:03:48 · 288 阅读 · 0 评论 -
POJ 1258 Agri-Net //Prim算法
题目描述POJ1258解题思路给出村庄的邻接矩阵,求其MST. Prim算法的模板题.参考代码#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#define inf 0x3f3f3f3f#define MAX_V 110using namespace原创 2015-07-15 20:50:45 · 342 阅读 · 0 评论 -
POJ 1861 Network //Kruscal算法
题目描述POJ1861 Network解题思路题目大意: 给出顶点数,边数,再输入若干条边,求出若干条边满足条件: 1)这几条边中长度最大的长度尽量小; 2)这若干条边可保证图的连通性; 3)在1,2的基础上,求个MST Kruscal算法求出的生成树满足一个特性:这个生成树的最长边是尽量短的.参考代码#include <iostream>#include <algorithm>#in原创 2015-07-15 20:40:54 · 279 阅读 · 0 评论 -
【POJ 2386】 Lake Counting
Description Due to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a rectangle of N x M (1≤N≤100;1≤M≤100) (1\leq N\leq 100; 1\leq M\leq 100) squares.原创 2015-02-20 17:32:44 · 359 阅读 · 0 评论 -
【POJ 2488】 A Knight's Journey
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 tw原创 2015-02-20 19:55:37 · 423 阅读 · 0 评论 -
【POJ 1562】 Oil Deposits
Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid th原创 2015-02-20 17:40:48 · 250 阅读 · 0 评论 -
POJ 2001 Shortest Prefixes // Trie
题目描述POJ 2001 Shortest Prefixes解题思路题目大意: 给出每个字符串的最短前缀表示,且不与其他字符串的表示相冲突。Trie中依次访问字符串的每个字符,若当前 字符节点 只被一个字符串所到达,则最短前缀即为从根节点到当前节点所构成的字符串。参考代码//**********************************************// Author: @xm原创 2015-10-26 23:09:37 · 312 阅读 · 0 评论