
POJ
文章平均质量分 61
Jun
着最闪的衫
扮十分感慨
有人来拍照要记住插袋
展开
-
POJ 3349 Snowflake Snow Snowflakes 暴力
题意:世界上没有相同的两片雪花。 请你验证这句话,将会给出每片雪花的信息,雪花有6片花瓣,如果存在两片雪花 花瓣的长度相同,则认为这两片雪花相同;思路:对每片雪花的 花瓣长度排序,再将所有的雪花 按照花瓣长度排序,这样如果两片雪花的花瓣长度都是相同的,则它们 必然相邻,对每对相邻的雪花比较,直到找到相同的雪花;1Y,2000MS+;#include #include using原创 2011-12-05 13:09:51 · 973 阅读 · 2 评论 -
POJ 3041 Asteroids 匈牙利算法 最小点覆盖
AsteroidsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8785 Accepted: 4702DescriptionBessie wants to navigate her spaceship through a dangerous asteroid原创 2011-12-01 19:23:57 · 1051 阅读 · 0 评论 -
POJ 1094 Sorting It All Out 拓扑排序
Sorting It All OutTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 18715 Accepted: 6380DescriptionAn ascending sorted sequence of distinct values is one in原创 2011-11-30 13:12:16 · 612 阅读 · 0 评论 -
POJ 1258 Agri-Net 最小生成树 Prim
Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 24644 Accepted: 9672DescriptionFarmer John has been elected mayor of his town! One of his campaign原创 2011-11-28 22:56:28 · 444 阅读 · 0 评论 -
POJ 3026 Borg Maze BFS + Prim
Borg MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4808 Accepted: 1617DescriptionThe Borg is an immensely powerful race of enhanced humanoids from t原创 2011-11-29 21:58:36 · 967 阅读 · 0 评论 -
POJ 1789 Truck History 最小生成树Prim算法
Truck HistoryTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 10733 Accepted: 3971DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types.原创 2011-11-28 21:45:32 · 684 阅读 · 0 评论 -
POJ 2485 Highways 最小生成树 Prim
HighwaysTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13985 Accepted: 6512DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Fla原创 2011-11-28 22:45:15 · 679 阅读 · 0 评论 -
POJ Heavy Cargo 最短路径 Dijkstra 变形
Heavy CargoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1924 Accepted: 1065DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturin原创 2011-11-28 19:06:08 · 1120 阅读 · 0 评论 -
POJ 2240 Arbitrage 最短路径 Floyd
ArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8936 Accepted: 3811DescriptionArbitrage is the use of discrepancies in currency exchange rates to原创 2011-11-27 19:00:11 · 521 阅读 · 0 评论 -
POJ 2253 Frogger 最短路径 Folyd
FroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14821 Accepted: 4902DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly原创 2011-11-26 21:37:59 · 1524 阅读 · 0 评论 -
POJ 3020 Antenna Placement 最小路径覆盖 匈牙利算法
题意: 某个国家 要建设 无线网络, 给出一个地图,地图为一个h*w的矩阵, 矩阵中*表示城市 O表示空地,无线网点 建设在一个城市 则在它上下左右4个方向上都可以被覆盖;求出 最少建设多少个 无线点 可以 覆盖所有的城市;思路:将城市看做顶点,它和在它覆盖范围内的 城市, 存在边关系, 建立二分图G(V,V,E);利用 匈牙利算法求得 最大匹配, 根据 公式:最小路径覆盖 = 顶点数 -原创 2011-12-01 20:40:16 · 512 阅读 · 0 评论 -
POJ 1936 All in All 字符串 处理
题意: 给出两个字符串 a,b。问 能否在 b串中删去某些元素 后 得到a;若能 输出Yes,否则No; 思路:对a每个元素 在b中查找,若找到 则记录 该元素在b中的位置,继续从记录位置查找下一个元素。直到 全部找到, 或 找不到。1Y 无压力#include using namespace std;const int N = 100010;char a[N]原创 2011-12-02 15:23:06 · 501 阅读 · 0 评论 -
POJ 1469 COURSES 二分图 最大匹配 匈牙利算法
题意:P门课程,N个学生,每个学生可以选任意门课,但每门课程须要一个代表,且每个学生只能成为一门课的代表。给出 第i门课 有哪些学生选, 问 能否达到要求;思路: 单纯的求 最大匹配 是不是等于P。#include using namespace std;const int P=110,N=310;int p,n;int link[N];bool map[P][N]原创 2011-12-01 21:44:53 · 488 阅读 · 0 评论 -
POJ 1002 487-3279 桶排
中文题,开8位 数组,保存每个号码重复的次数,按字典序输出 每个出现次数大于1的号码;气死我了,把大写的K写成k ,WA了我9次啊!! 我个去!!#include #include using namespace std;int num[10000000];int get_num(char t){ if(t>='0' && t<='9') return t-'0';原创 2011-12-05 12:34:00 · 228 阅读 · 0 评论 -
POJ题目分类 及 已完成题目
初级: 一.基本算法: (1)枚举. (poj1018,poj1753,poj2965,poj2586)(2)贪心( poj1328, poj2109 )(3)递归和分治法. (4)递推. (5)构造法.(poj3295,poj3239)(6.1)模拟法.(poj1008,poj1068,poj2632,poj1573,poj2993,poj2996,poj30转载 2011-11-22 12:48:24 · 437 阅读 · 0 评论 -
POJ 2388 1804 2299 排序 (逆序数 归并排序)
POJ 1804 求逆序数 直接 冒泡水、其实只需要统计 逆序的就可以了 不需要这么复杂#include using namespace std;int num[1001];int main(){ int t,n,i,j,temp,Case=0,step; scanf("%d", &t); while(t--) { scanf("%d", &n); fo原创 2011-12-04 22:32:03 · 514 阅读 · 0 评论 -
POJ 1007 DNA Sorting 排序sort
#include #include using namespace std;struct Data{ char str[60]; int num;}data[110];bool cmp(Data a, Data b){ if(a.num >= b.num) return 0; else return 1;}int main(){ i原创 2011-12-02 15:25:50 · 479 阅读 · 0 评论 -
POJ 1466 Girls and Boys 最大独立集数 匈牙利算法
求二分图的最大独立集数最大独立集数D = 顶点数V - 最小点覆盖数C最小点覆盖数C = 最大匹配数M orz 竟然跑了3.485S、、#include using namespace std;const int N = 510;int link[N];bool map[N][N],used[N];int n;bool DFS(int t){ f原创 2011-12-01 22:19:59 · 533 阅读 · 0 评论 -
POJ 3080 Blue Jeans 最长公共子串 string
题意:给出N个DNA 序列,序列长度都为60,找出最长的公共子串,如果有多个相同长度的子串,按字典序输出 第一个;思路:暴力 枚举所有长度 的 第一个串的子串, 查找其他串中是否都包含该 子串;顺便 学习了下C++ string的 substr( 开始位置,截取长度),和find方法#include #include #include using namespace st原创 2011-12-02 14:19:50 · 465 阅读 · 0 评论 -
POJ 1035 Spell checker 字符串 操作
题意:给出字典 #为结束,再 输入单词, 判断该单词的拼写状态,状态有5种:1. 字典中包含该单词;2.该单词比正确单词缺了一个字母;3.该单词与正确单词比 只有一个不同;4.该单词与正确单词比 多了一个字母;5.该单词 在字典中 找不到上述情况。 1: 输出 word is correct; 2 ~4:按照 字典中的顺序 输出 所有可能的正确单词; 5:输出原创 2011-12-02 13:12:41 · 729 阅读 · 0 评论 -
POJ 1016 Numbers That Count 模拟 字符串
题意:给出数字串 对数字串进行压缩,判断压缩后的串 会不会形成循环;循环的情况有,第一次压缩就产生循环,压缩n次后循环,或者 k个压缩形成循环。只需要对15次压缩进行判断;思路:模拟题目给出的压缩方法 对数字串压缩,保存15次压缩产生的串;三种情况 讨论;忘记对n 字符串加 结束,RE4次 ,输出少一个空格PE一次、无语了、 #include using namespace原创 2011-12-02 13:05:10 · 165 阅读 · 0 评论 -
POJ 1274 The Perfect Stall 最大匹配 匈牙利算法
单纯的求最大匹配 - -、第一道觉得有点难 第二道觉得简单 第三道就是水题了 。。汗#include using namespace std;const int N=210;int n,m;int link[N];bool map[N][N],used[N];bool DFS(int x){ for(int i=1; i<=m; i++) { if(!原创 2011-12-01 21:52:11 · 162 阅读 · 0 评论 -
POJ 1125 Stockbroker Grapevine 最短路径 Floyd
Stockbroker GrapevineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 18345 Accepted: 9931DescriptionStockbrokers are known to overreact to rumours. You ha原创 2011-11-26 23:35:26 · 578 阅读 · 0 评论 -
POJ 1062 昂贵的聘礼 最短路径 Dijkstra算法
又是一道难得的中文题。 思路: 利用Dijkstra算法, 求 最短路径; 一开始 对 Dijkstra算法 理解不太到位,导致wa一次; 然后 再做 仍然wa ,因为 自以为 酋长的等级一定是最高的 - -; 对 等级范围 取值 枚举 ,重复求 最短路径, AC原创 2011-11-26 20:20:25 · 771 阅读 · 0 评论 -
POJ 1008 Maya Calendar 模拟
题目老长一片,看半天才发现这题还有中文版!都说题目越长 越水、、果然很水; 要输出 日期个数 - -悲了个剧,贡献两个WA;#include #include using namespace std;char haab[19][10]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "che原创 2011-11-23 18:51:29 · 440 阅读 · 0 评论 -
POJ 2632 Crashing Robots 模拟
Crashing RobotsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4679 Accepted: 2052DescriptionIn a modernized warehouse, robots are used to fetch the goods原创 2011-11-23 22:58:46 · 705 阅读 · 0 评论 -
POJ 1068 Parencodings 模拟
ParencodingsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13244 Accepted: 7874DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S c原创 2011-11-23 20:33:52 · 661 阅读 · 0 评论 -
POJ 1222 1753 熄灯问题 枚举
题目大概意思 都是 给出一个n*m的0 1矩阵, 改变其中一个位置为(i,j)的点的状态 则该点 上下左右的状态同时改变;现给出一个矩阵 要你求出到达目标状态的最小改变次数 或者 输出 需要按下的位置 思路:1.某个点被按下两次 则回到初始的状态 也就是每个点 最多只需要按一次 那总共不会超过n*m次; 2.要使第一行的状态都为1 或0 只要把 第一行需改变的原创 2011-11-22 12:35:57 · 1046 阅读 · 0 评论 -
POJ 2109 Power of Cryptography
K^N = P 给出P和N 求K ,1101 ; K=P^(1/N) ,K=log(p)/log(n); 本来想用JAVA做 - - 结果被我看到了这个神一样的代码 #include #include using namespace std;int main(){原创 2011-11-22 17:19:27 · 324 阅读 · 0 评论 -
POJ 1328 Radar Installation 贪心
Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 28996 Accepted: 6352DescriptionAssume the coasting is an infinite straight line. Land is原创 2011-11-22 16:36:26 · 1094 阅读 · 0 评论 -
POJ 2586 Y2K Accounting Bug 枚举
E文看不懂啊、、、、题目看半天题意: MS公司的每月收入汇报丢失了 只知道连续的5个月是亏的 每个月只有盈利S和亏损D两种情况现 给你S和D 要你求出 本年是否能盈利 若能 则 输出 最大盈利值 否则输出 Deficit 思路: 每年12月 ,有8个连续的五个月 对 S 和 D 的关系 讨论当 4S 3S 2S S原创 2011-11-22 19:06:13 · 383 阅读 · 0 评论 -
POJ 2965 The Pilots Brothers' refrigerator
题意 类似 1753,给出一个4*4的矩阵 包含两种符号'+'和'-','-'代表打开 '+'代表关闭,按下其中一个位置 则该位置的所在行和所在列状态都改变, 现在要你 输出 改变哪些位置 可以使得 此矩阵上的符号都为'-'; 思路:参考高手的高效解法:> 证明:要使一个为'+'的符号变为'原创 2011-11-22 14:34:12 · 383 阅读 · 0 评论 -
POJ 3295 Tautology 枚举 构造
TautologyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5052 Accepted: 1910DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six f原创 2011-11-22 21:23:31 · 900 阅读 · 0 评论 -
POJ 3239 Solution to the n Queens Puzzle 犀利利的构造公式
Solution to the n Queens PuzzleTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 2897 Accepted: 1067 Special JudgeDescriptionThe eight queens puzzle原创 2011-11-23 15:33:55 · 1065 阅读 · 0 评论 -
POJ 1573 Robot Motion 简单模拟
Robot MotionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7080 Accepted: 3399DescriptionA robot has been programmed to follow the instructions in原创 2011-11-24 08:09:08 · 567 阅读 · 0 评论 -
POJ 2993 Emag eht htiw Em Pleh 模拟
题意: 把POJ2996的输入 当 输出 把 2996的输出当输入、、思路: 模拟 还原棋盘1Y 无压力、、#include #include using namespace std;struct P{ int x,y; char d;}p[80];bool cmp(P a, P b){ if(a.x!=b.x) return a.x<b.x;原创 2011-11-24 17:22:42 · 434 阅读 · 0 评论 -
POJ 1860 Currency Exchange 最短路径算法的运用
题意:有N种货币 M个交换点,每个交换点提供 a,b两种货币的交换 汇率为rate 手续费为commission;假设你持有一种货币(S) 面值V;让你去交换其他货币,如果你能找到一个交换路径 使得你的钱一直在增加 则输出YES 否则 输出NO; 思路:设货币 为 点, 交换点为 边; (现有货币-手续费) *汇率 为边的关系函数;题意即求 最长路径 判断 图 是否存在 正权回路;原创 2011-11-26 13:54:51 · 891 阅读 · 0 评论 -
POJ 3259 Wormholes 最短路径 Bellman_Ford
WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16566 Accepted: 5834DescriptionWhile exploring his many farms, Farmer John has discovered a num原创 2011-11-26 15:05:28 · 1094 阅读 · 0 评论 -
POJ 序列 大数加法
POJ难得一见的中文题、、、、http://poj.org/problem?id=3982JAVA继续水、import java.math.*;import java.util.*;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.原创 2011-11-24 21:01:42 · 521 阅读 · 0 评论 -
POJ 2602 Superlong sums 大数加法
Superlong sumsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 20168 Accepted: 5842DescriptionThe creators of a new programming language D++ have found out原创 2011-11-24 20:45:37 · 978 阅读 · 0 评论