自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

bobten2008的专栏

The art of algorithm

  • 博客(43)
  • 资源 (9)
  • 收藏
  • 关注

原创 POJ 1907 Work Reduction

 Work ReductionTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1292 Accepted: 438DescriptionPaperwork is beginning to pile up on your desk, and tensions

2009-11-28 21:03:00 1107

原创 POJ 1904 King's Quest

 Kings QuestTime Limit: 15000MS Memory Limit: 65536KTotal Submissions: 2957 Accepted: 993Case Time Limit: 2000MSDescriptionOnce upon a time there lived a

2009-11-28 15:57:00 1010

原创 POJ 1906 Three Powers

Three powersTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 3299 Accepted: 1405DescriptionConsider the set of all non-negative integer powers of 3. S = {

2009-11-28 11:20:00 974

原创 POJ 1811 Prime Test

Prime TestTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 15434 Accepted: 2909Case Time Limit: 4000MSDescriptionGiven a big integer number, you are

2009-11-27 21:21:00 2291 7

原创 POJ 1826 The Best Farm

The Best FarmTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 1519 Accepted: 455DescriptionBackground In a fight against invaders, farmer William get the

2009-11-24 19:40:00 1123

原创 POJ 1830 开关问题

开关问题Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1701 Accepted: 537Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系的开关

2009-11-23 20:50:00 2915

原创 POJ 1873 The Fortified Forest

The Fortified ForestTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1894 Accepted: 561DescriptionOnce upon a time, in a faraway land, there lived a king.

2009-11-22 21:44:00 835

原创 POJ 1874 Trade on Verweggistan

Trade on VerweggistanTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1238 Accepted: 355DescriptionSince the days of Peter Stuyvesant and Abel Tasman, Du

2009-11-22 15:22:00 1216

原创 POJ 1894 Alternative Scale of Notation

Alternative Scale of NotationTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1530 Accepted: 538DescriptionOne may define a map of strings over an alphab

2009-11-21 23:06:00 1133

原创 POJ 1899 Farmer Bill's Problem

 Farmer Bills ProblemTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2159 Accepted: 514DescriptionIt is rumored that the planet Earth is often visited

2009-11-21 17:35:00 875

原创 POJ 1734 Sightseeing trip

/*第一次用扩展的Floyd来寻找最小代价环*/#include #define MAX_N 105#define MAX_VAL 666666666using namespace std;int N, M, minLen;int weight[MAX_N + 1][MAX_N + 1];int graph[MAX_N + 1][MAX_N + 1];int p

2009-11-20 14:25:00 1427 2

原创 POJ 1733 Parity Game

Parity gameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2426 Accepted: 992DescriptionNow and then you play the following game with your frien

2009-11-20 14:19:00 1131

原创 POJ 1732 Phone numbers

 Phone numbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2456 Accepted: 852 Special JudgeDescriptionIn the present world you frequently meet a

2009-11-20 14:03:00 1621

原创 POJ 1730 Perfect Pth Powers

Perfect Pth PowersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9722 Accepted: 2139DescriptionWe say that x is a perfect square if, for some integer b,

2009-11-18 22:26:00 1162

原创 POJ 1728 A flea on a chessboard

A flea on a chessboardTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1509 Accepted: 491DescriptionAn infinite chessboard is obtained by extending a finit

2009-11-18 20:29:00 1002

原创 POJ 1724 ROADS

 /*可以算作是A*算法了,利用priority_queue实现*/#include #include #define MAX_N 100#define MAX_K 10000using namespace std;struct node{    int countv;    int data[MAX_N * MAX_N + 5][3]; //id,

2009-11-18 20:20:00 680

原创 POJ 1719 Shooting Contest

Shooting ContestTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2279 Accepted: 809 Special JudgeDescriptionWelcome to the Annual Byteland Shooting C

2009-11-17 23:28:00 713

原创 POJ 1708 Game

 /*纯BFS,注意两个点之间可以有多条边,所以每个点相连的点的总数可能很大,一开始把circle 里的conn开小了,WA,开大点就OK了*/#include #include #define MAX_N 100using namespace std;struct circle{    int color;    int countv;    

2009-11-17 20:14:00 964

原创 POJ 1716 Integer Intervals

 Integer IntervalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7116 Accepted: 2852DescriptionAn integer interval [a,b], a Write a program that: finds

2009-11-17 20:13:00 946

原创 POJ 1715 Hexadecimal Numbers

 Hexadecimal NumbersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1489 Accepted: 347DescriptionThe base of the hexadecimal system is 16. In order to w

2009-11-17 20:09:00 1277

原创 POJ 1702 Eva's Balance

Evas BalanceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2889 Accepted: 1424DescriptionEva has a balance with 20 poises. The weights of the poises are

2009-11-16 20:54:00 745

原创 POJ 1701 Dissatisfying Lift

 /*很不错的递推题,一开始想着枚举,后来掂量了下肯定会TLE,然后分析各层之间的数据关系得到O(n)的算法:数据结构: sum[i]: 1至i层租户的总数, num[i]: 第i层的租户数updec[i]: i层至n层所有用户少走一层减少的不满意度, 通过数学推倒很容易发现 updec[i] = updec[i + 1] + a * num[i] + sum[m] - sum[i];

2009-11-16 19:24:00 1135

原创 POJ 1797 Heavy Transportation

 /*dijstra的变体,求从1到n的所有路径上最小权值的最大值第一次用STL的priority_queue,以前都是自己手写堆,效率不是很理想,看来以后还得自己手写6131486bobten20081797Accepted9464K454MSC++2140B2009-11-15 19:42:25*/

2009-11-15 22:55:00 627

原创 POJ 1659 Frogs' Neighborhood

 /*一开始用了带剪枝的搜索,不知道为什么一直WA后来改成havel贪心定理才AC,有兴趣的拿去研究下下面这个搜索为什么过不了#include #define MAX_S 600#define MAX_N 9using namespace std;int states[MAX_N + 1][MAX_S + 1];int curStates[MAX_N + 1];

2009-11-14 21:24:00 755

原创 POJ 1655 Balancing Art

 Balancing ActTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4573 Accepted: 1800DescriptionConsider a tree T with N (1 For example, consider the tree: 

2009-11-13 13:24:00 837

原创 POJ 1656 Counting Black

Counting BlackTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6578 Accepted: 4229DescriptionThere is a board with 100 * 100 grids as shown below. The left

2009-11-13 13:19:00 1014

原创 POJ 1637 Sightseeing tour

Sightseeing tourTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2639 Accepted: 1071DescriptionThe city executive board in Lund wants to construct a sigh

2009-11-11 21:58:00 1472

原创 POJ 1609 Tilining Up Blocks

 Tiling Up BlocksTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3016 Accepted: 1148DescriptionMichael The Kid receives an interesting game set from his

2009-11-11 19:31:00 1031

原创 POJ 1661 Help Jimmy

Help JimmyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5993 Accepted: 1840Description"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度

2009-11-11 19:27:00 1745

原创 POJ 1244 Slots of Fun

 Slots of FunTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 748 Accepted: 441DescriptionThe International Betting Machine company has just issued a n

2009-11-08 14:09:00 902

原创 POJ 1639 Picnic Planning

 /*这题调得快吐血了,做得真辛苦这题主要就是求最小限度生成树,即给定一棵树,在某个节点上加上这个节点的最大度数,然后求一棵满足这样条件的树且最终的权值和最小。这道题就是在根节点Park上做度数限定,然后求最小限度生成树最小限度生成树的求法与MST(最小生成树密不可分)主要思路有以下几个步骤1)将根节点从图中去除掉2)对去除根节点的图求MST,注意这里去除根后的图可能是

2009-11-07 19:33:00 1742

原创 POJ 1635 Subway tree systems

 /*主要是根据输入串建树,然后对树DFS,重新获得一个排序后的01串。对两个输入串分别运用上述方法分别得到两个排序后的01串,如果两个串相等则same,否则different关键在于DFS时对子树返回的01串进行存储和排序,然后重组比如对于0100101100100111和0011000111010101,重组后分别变成:0001101100101101和0001110011

2009-11-07 10:48:00 1320 1

原创 POJ 1673 EXOCENTER OF A TRIANGLE

 EXOCENTER OF A TRIANGLETime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1853 Accepted: 682DescriptionGiven a triangle ABC, the Extriangles of ABC are co

2009-11-06 14:12:00 1225 3

原创 POJ 1632 Vase collection

 Vase collectionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1536 Accepted: 552DescriptionMr Cheng is a collector of old Chinese porcelain, more spec

2009-11-06 14:10:00 1422

原创 POJ 1675 Happy Birthday

 Happy Birthday!Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3352 Accepted: 791DescriptionThere are three berries on a round birthday cake. You a

2009-11-05 22:25:00 890

原创 POJ 1679 The Unique MST

 /*要求:这道题的要求是给定一个无向联通图,判断这个图的最小生成树MST是不是唯一的,如果是唯一的则打印出最小值,如果不是唯一的给出提示分析:采用Kruskal算法来计算最小生成树,仔细分析其过程不难发现这个图的MST不唯一的充分必要条件是在Kruskal运算过程中如果选中的当前边a构成了环,且在所有包含这条边的环中如果存在和这条边权值相等的边b,则MST不唯一,因为总是可以

2009-11-03 20:57:00 819

原创 POJ 1691 Painting A Board

 /*DFS拓扑排序,要注意局部状态的记录建图的方法:如果矩形a是紧邻b上方的矩形,则graph[a][b] = trueDFS时,每次记录上一次用到的刷子的颜色,然后从当前记忆保存的graph中寻找入度为0的矩形,如果其颜色不等于上一次用到的刷子的颜色,则总数+1,然后从新的矩形中清除掉以这个矩形为端点的变,继续下一次DFS*/#include #define M

2009-11-03 17:21:00 837

原创 POJ 1692 Crossed Matchings

 Crossed MatchingsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1578 Accepted: 1020DescriptionThere are two rows of positive integer numbers. We can d

2009-11-03 17:20:00 1148

原创 poj 1695 Magazine Delivery

 Magazine DeliveryTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1590 Accepted: 766DescriptionThe TTT Taxi Service in Tehran is required to deliver s

2009-11-02 20:51:00 900

原创 POJ 1694 An Old Stone Game

 /*先建树,然后对树进行后序遍历假设nodes[i].score表示以i为根的子树需要的石头数,则(1)对于叶子节点其score为1(2)对于非叶子节点,先将其所有子节点按照其所需score数降序排序,然后遍历其子节点    int need = 0, rest = 0, need表示遍历到当前子树需要的石头数,rest表示剩下的石头数  for( sid : is son

2009-11-02 20:49:00 663

Learning Python 第三版

python 第三版,学习Python入门级的好教材

2010-05-19

ACM Trie树 模板 字典树

ACM Trie树 模板,字典树模板,数据结构

2010-05-19

大数运算工具C++版

用C++实现的大数运算工具 包括:加 减 乘 除 指数 模指幂 等常见运算

2009-10-14

C++实现的大数运算工具 v1.1

用C++实现的大数运算工具; 包括大数加减乘除,模指幂等常用运行! 原版v1.0中的乘法运算存在一个bug,本版本对这个bug进行了修正,所以,下载请下载本版本,不要下载v1.0

2009-08-06

C++实现的大数运算工具 v1.0

用C++实现的大数运算工具; 包括大数加减乘除,模指幂等常用运行! 注:此版本的大数乘法存在一个bug,v1.1对其进行了修正。请下载最新的1.1版本

2009-06-24

RSA 公钥加密算法实现

RSA公钥加密算法实现 当前版本是1.0,版本很快会进行完善!

2009-06-08

POJ 1861 Network

利用并查集判断环路,以及快速排序计算最小生成树

2009-05-27

JAVA下基于邻接表的图的通用算法实现

(1) 基于邻接表的图的构建功能 (2) 标准Dijkstra算法 (3) 有向图的强连通算法 Environment: Eclipse 3.4 + JDK 1.6 注:目前只实现了以上三个功能,但由于各功能都基于模块化分解的思想实现,所以加入新功能会比较方便,易于扩展。

2009-04-15

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除