
北大POJ
文章平均质量分 87
施工中请绕行
喜欢研究底层技术,编译原理,操作系统技术,数据库引擎实现原理。2012年校园招聘进入腾讯北分云平台部,从事终端开发职位。
展开
-
POJ 1941 三角形分形
The Sierpinski FractalTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2684 Accepted: 1240DescriptionConsider a regular triangular area, divide it into fou原创 2012-08-31 10:04:04 · 2913 阅读 · 0 评论 -
POJ1833解题报告 后k个排列
排列Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 9564 Accepted: 4223Description题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1个排列,即排列1 2 3…原创 2011-02-04 20:41:00 · 1279 阅读 · 0 评论 -
POJ1731解题报告 不重复全排列
OrdersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6402 Accepted: 4052DescriptionThe stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the kinds having labels starting with the same letter are stored in原创 2011-02-04 16:19:00 · 1880 阅读 · 0 评论 -
POJ3331解题报告 高精度幂
The Idiot of the Year Contest!Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3074 Accepted: 1591DescriptionThere is just one basic rule in the Idiot of the Year Contest (IYC)! The contestant picks a random digit between 0 and 9, computes the fac原创 2011-02-01 21:12:00 · 946 阅读 · 0 评论 -
POJ3414解题报告 BFS
PotsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4638Accepted: 1965Special JudgeDescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i原创 2011-02-01 14:42:00 · 1137 阅读 · 0 评论 -
POJ2586解题报告
Y2K Accounting BugTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4485 Accepted: 2146DescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they原创 2011-02-01 14:35:00 · 1168 阅读 · 0 评论 -
POJ2001解题报告
Shortest PrefixesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 6143 Accepted: 2512DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and原创 2011-01-26 17:02:00 · 908 阅读 · 0 评论 -
POJ1745解题报告
DivisibilityTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6873 Accepted: 2294DescriptionConsider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmetical expression原创 2010-11-21 21:00:00 · 932 阅读 · 0 评论 -
poj1458解题报告
最长公共子序列问题百度找的动态规划算法如下:以两个序列 X、Y 为例子: 设有二维数组 f[i,j] 表示 X 的 i 位和 Y 的 j 位之前的最长公共子序列的长度,则有: f[1][1] = same(1,1); f[i,j] = max{f[i-1][j ? 1] + same(i,j),f[i-1,j],f[i,j?1]} 其中,same(a,b)当 X 的第 a 位与 Y 的第 b 位完全相同时为“1”,否则为“0”。 此时,f[j]中最大的数便是 X 和 Y 的最长公共子序列原创 2010-11-14 18:47:00 · 840 阅读 · 0 评论 -
POJ3624解题报告
Charm BraceletTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7247 Accepted: 3278DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤原创 2010-12-27 10:41:00 · 1524 阅读 · 0 评论 -
poj1321解题报告
棋盘问题Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9462 Accepted: 4600Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以原创 2010-10-23 19:14:00 · 728 阅读 · 0 评论 -
POJ1184 超时..
聪明的打字员Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3647 Accepted: 759<br />Description阿兰是某机密部门的打字员,她现在接到一个任务:需要在一天之内输入几百个长度固定为6的密码。当然,她希望输入的过程中敲击键盘的总次数越少越好。 <br />不幸的是,出于保密的需要,该部门用于输入密码的键盘是特殊设计的,键盘上没有数字键,而只有以下六个键:Swap0, Swap1, Up, Down, Left,原创 2010-12-09 16:15:00 · 937 阅读 · 0 评论 -
POJ2252解题报告 解一元一次方程
Equation SolverTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 427 Accepted: 266DescriptionWrite a program that can solve linear equations with one variable.InputThe input will contain a number of equations, each one on a separate line. All equat原创 2010-12-09 16:10:00 · 1726 阅读 · 0 评论 -
poj2255解题报告
Tree RecoveryTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4585 Accepted: 3061DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the no原创 2010-10-13 06:58:00 · 826 阅读 · 0 评论 -
POJ1775解题报告.....郁闷
Sum of FactorialsTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 10449 Accepted: 3388DescriptionJohn von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mat原创 2010-11-27 16:00:00 · 1389 阅读 · 0 评论 -
poj1528解题报告
<br />大水题。。。飘过<br /> <br /> <br /> <br />#include<iostream>#include<cmath>using namespace std;int s(int n){ int i,sum=1; for(i=2;i<=(int)sqrt((double)n);i++) if(n%i==0) sum+=i+n/i; if((int)sqrt((double)n)*(int)sqrt((double)n)==n)原创 2010-09-27 20:50:00 · 1253 阅读 · 0 评论 -
POJ1089解题报告 区间合并
IntervalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5345 Accepted: 2087DescriptionThere is given the series of n closed intervals [ai; bi], where i=1,2,...,n. The sum of those intervals may be represented as a sum of closed pairwise non−inte原创 2011-02-06 18:56:00 · 2190 阅读 · 0 评论 -
POJ2876解题报告 递归
Cantoring AlongTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2963 Accepted: 1608DescriptionThe Cantor set was discovered by Georg Cantor. It is one of the simpler fractals. It is the result of an infinite process, so for this program, printing原创 2011-02-06 18:59:00 · 1855 阅读 · 0 评论 -
POJ 3264解题报告
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 16578 Accepted: 7674Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to org原创 2011-04-04 09:24:00 · 912 阅读 · 1 评论 -
nlogn求逆序数 POJ 2299解题报告
前几天自己想出了利用归并排序求逆序数的方法,找了一个求逆序数的题2299 交了300++MS水过... Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 19686 Accepted: 6959DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a seque原创 2011-03-29 11:45:00 · 1547 阅读 · 0 评论 -
欧几里德算法总结
欧几里德算法int Eucild(int a,int b) //欧几里德算法求gcd(a,b){if(!a)return b;return Eucild(b%a,a);}扩展欧几里德算法扩展欧几里德算法是在欧几里德算法的基础上加了一些功能,使其不仅能够求A,B的最大公约数gcd(A,B),而且能求形如Ax+By=gcd(A,B)的x和y的整数解。为了便于理解扩展欧几里德算法,先来分析一下欧几里德算法求最大公约数的过程,欧几里德算法的递归出口是a为0,当递归到某原创 2011-05-17 14:24:00 · 1249 阅读 · 0 评论 -
POJ 3468 线段树
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 19890 Accepted: 5238Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to原创 2011-05-08 14:25:00 · 849 阅读 · 0 评论 -
POJ1236解题报告 强连通分支+缩点
Network of SchoolsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4177 Accepted: 1636DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools t原创 2011-02-21 15:25:00 · 1643 阅读 · 3 评论 -
POJ1523解题报告 求点割集
SPFTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2082 Accepted: 932DescriptionConsider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a si原创 2011-02-23 16:37:00 · 1933 阅读 · 0 评论 -
POJ2553解题报告 强连通分支
The Bottom of a GraphTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 4000 Accepted: 1637DescriptionWe will use the following (standard) definitions from graph theory. Let V be a nonempty and finite set, its elements being called vertices (or node原创 2011-02-21 10:46:00 · 1276 阅读 · 0 评论 -
POJ 1930 解题报告 无限循环小数化分数
Dead FractionTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1258 Accepted: 379DescriptionMike is frantically scrambling to finish his thesis at the last minute. He needs to assemble all his research notes into vaguely coherent form in the next 3原创 2011-03-08 11:46:00 · 4204 阅读 · 0 评论 -
POJ2186解题报告 强连通分支+缩点
这道题刚开始我用的普通DFS直接搜索,不幸的是超内存了,因为我无知的开了一个长度为1亿的字符数组(PS:以后开大数组前一定要先算一下需要的内存),被MLE后不甘心继续修改,把内存降下来后继续提交,TLE,再改,再TLE。。若干次后我意识到普通算法好像过不去。。也没有心思再改了。。。看了讨论才知道这个需要用求强连通分量的tarjan算法,百度上找到tarjan,看了挺长时间才把他真正看懂。。看懂了tarjan,我又想了一个多小时,写出代码,终于将这道题AC。。真不容易,不过这道题让我学到了新的东西,A掉这题的原创 2011-02-20 20:49:00 · 1455 阅读 · 0 评论 -
POJ 2004解题报告
Mix and BuildTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3246 Accepted: 963Case Time Limit: 2000MS Special JudgeDescriptionIn this problem, you are given a list of words (sequence of lower case letters). From this list, find the longest chain原创 2011-02-28 20:48:00 · 1341 阅读 · 1 评论 -
POJ2005解题报告 计算概率
BlackjackTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1760 Accepted: 485DescriptionIn the Blackjack card game, the player and the dealer are dealt two cards initially. One of dealer's cards is dealt face up and is known to the player but the o原创 2011-02-28 20:39:00 · 1249 阅读 · 0 评论 -
POJ1013解题报告 暴力搜索
Counterfeit DollarTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 27834 Accepted: 8700DescriptionSally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its c原创 2011-02-09 17:15:00 · 984 阅读 · 0 评论 -
POJ1068解题报告
ParencodingsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11181 Accepted: 6583DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the原创 2011-02-08 16:17:00 · 4026 阅读 · 0 评论 -
poj3461解题报告
OulipoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6114 Accepted: 2329<br />Description<br />The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote fr原创 2010-09-27 21:36:00 · 881 阅读 · 0 评论 -
poj1411解题报告
Calling Extraterrestrial Intelligence Again Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8938 Accepted: 3585 Description A message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the原创 2010-09-05 08:54:00 · 1026 阅读 · 0 评论 -
poj2312解题报告
<br />第三个BFS<br />题目大意:这个题是以坦克大战为原型出来的题目,就是走迷宫的变种,给定一个地图mxn的地图,地图上有普通的砖B,金砖S,河R,和一个宝物位置T,和你的位置Y,求吃到宝物的最小步数(坦克通过普通砖需要两步,不能通过金砖和河)...<br /><br /> <br />Sample Input3 4YBEBEERESSTE0 0<br />Sample Output8<br /> <br />思路:走迷宫的思路,加点变化,在将横纵坐标步数入队的同时在将sta原创 2010-08-11 20:34:00 · 996 阅读 · 0 评论 -
poj3126解题报告
<br />我的第二道BFS题<br />题目大意:给定两个4位的质数a和b,从a开始每次只能改变a的一个数字,并且改完后的a还是质数,求a最少经过几次变换能得到b.....<br /> 比如1033变到8179最少需要6次,过程如下<br />1033<br />1733<br />3733<br />3739<br />3779<br />8779<br />8179<br /> <br /> <br />解题思路:典型BFS<br /> <br />#include<iostream>#inclu原创 2010-08-11 20:33:00 · 2226 阅读 · 1 评论 -
poj2251解题报告
<br />给定一个3D迷宫判断走出去的最小步数....<br />Sample Input3 4 5S.....###..##..###.#############.####...###########.#######E1 3 3S###E####0 0 0<br />Sample OutputEscaped in 11 minute(s).Trapped!<br /> <br />我的首个BFS题,感谢小杰的原创 2010-08-11 20:31:00 · 853 阅读 · 0 评论 -
poj2245解题报告
<br />题目大意:给定一个递增的序列,输出在这个序列中的6个元素的递增全排列。。。<br /> <br /> <br />#include<iostream>using namespace std;int num[20],n;void find(int i,int finded,int shows[]){ int show[7],j; for(j=1;j<7;j++) show[j]=shows[j]; show[finded]=i-1; if(finded=原创 2010-08-11 20:27:00 · 733 阅读 · 0 评论 -
poj1159解题报告
<br />题目大意:给定一个字符串,让你在这个串中加入最少的字符,使其成为回文串,(回文串就是正着读和反着读一样的串)比如:"Ab3bd"加入最少加入两个字符才能成为回文串"dAb3bAd"或者 "Adb3bdA"。。。。求最少添多少个字符。。。<br /> <br />思路:假设长度为len的字符串存在str[ ]里,初始left=0,right=len-1,如果str[left]不等于str[right]那么则有find(letf,right)=min(find(left,rght-1),find(l原创 2010-08-11 20:25:00 · 746 阅读 · 0 评论 -
poj1102解题报告
<br />题目大意:给定字体大小,和一个数,将这个数按给定的字体大小显示出来。。。。<br />Sample Input2 123453 678900 0<br />Sample Output -- -- -- | | | | | | | | | | | | -- -- -- -- | | | | | | | | | |原创 2010-08-11 20:22:00 · 1138 阅读 · 0 评论 -
poj2533解题报告
<br />题意:求一个序列中最长上升子序列<br />Sample Input<br />7<br />1 7 3 5 9 4 8<br />Sample Output4思路:以第i位元素开始的最长上升子序列长度等于1加上i+1~n中的某个j位的最长上升子序列(a[i]<a[j]),然后递归求解#include<iostream>using namespace std;int n,a[1010],maxl[1010];void find(int i){ int j,flag=0;原创 2010-08-11 20:19:00 · 1082 阅读 · 0 评论