自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(125)
  • 收藏
  • 关注

原创 UVa 10602 Editor Nottoobad (等价转换思想)

10602 - Editor NottoobadTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1543Company Macrohard has releas

2013-10-31 20:45:34 1177

原创 Central Europe 1996 / UVa 311 / POJ 1017 Packets (贪心)

311 - PacketsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=247A factory produces products packed in sq

2013-10-31 13:16:55 1331

原创 UVa 10700 Camel trading (计算表达式)

10700 - Camel tradingTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1641Background Aroud 800 A.D., El

2013-10-31 13:04:55 1416

原创 UVa 10487 Closest Sums (遍历&二分查找)

10487 - Closest SumsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1428Given is a set of integers and t

2013-10-31 12:19:27 1388

原创 UVa 10057 A mid-summer night's dream. (二分&可以取哪些作为中位数?)

输出注意:第一个数是最小的A,第二个数是在数列{Xn}中有多少个数可以是A,第三个数是在有多少个数可以是A。完整代码:

2013-10-30 21:56:22 2328

原创 TZC 1472 逆置正整数,去前导零 (java一句话秒杀)

逆置正整数http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1472时间限制(普通/Java):1000MS/10000MS     运行内存限制:65536KByte描述输入一个三位正整数,将它反向输出。输入3位正

2013-10-30 09:35:36 1995 1

原创 UVa 10132 File Fragmentation (想法题)

10132 - File FragmentationTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1073Your friend, a biochemistr

2013-10-30 08:47:47 1099

原创 UVa 10763 Foreign Exchange (map的应用)

10763 - Foreign ExchangeTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1704Your non-profit organization

2013-10-29 19:53:42 2249 2

原创 UVa 10020 Minimal coverage (贪心&区间覆盖)

10020 - Minimal coverageTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=961The ProblemGiven several

2013-10-29 19:28:06 1806

原创 UVa 331 Mapping the Swaps (DFS)

331 - Mapping the SwapsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=267Sorting an array can be done b

2013-10-29 08:31:28 898

原创 UVa 140 Bandwidth (枚举全排列&剪枝搜索)

140 - BandwidthTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=76Given a graph (V,E) where V is a set of

2013-10-29 08:04:18 1110

原创 UVa 10924 Prime Words (素数)

10924 - Prime WordsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1865A prime number is a number that ha

2013-10-28 20:59:31 1267

原创 UVa 327 Evaluating Simple C Expressions (模拟)

327 - Evaluating Simple C ExpressionsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=263The task in this

2013-10-28 20:16:08 1049 4

原创 UVa 548 Tree (中序遍历&后序遍历&DFS)

548 - TreeTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=489You are to determine the value of the leaf

2013-10-28 15:08:10 928

原创 UVa 699 The Falling Leaves (DFS遍历二叉树)

699 - The Falling LeavesTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=640Each year, fall in the North Central regio

2013-10-26 22:47:34 1045

原创 POJ 2106 / México and Central America 2004 Boolean Expressions (用栈处理表达式)

Boolean Expressionshttp://poj.org/problem?id=2106Time Limit: 1000MSMemory Limit: 30000KDescriptionThe objective of the program you are going to produce is to evaluate boolean e

2013-10-25 16:30:52 1888

原创 POJ 2105 / México and Central America 2004 IP Address (strtoll函数)

IP Addresshttp://poj.org/problem?id=2105Time Limit: 1000MSMemory Limit: 30000KDescriptionSuppose you are reading byte streams from any device, representing IP addresses. Your t

2013-10-25 15:51:21 1012

原创 UVa 639 Don't Get Rooked (DFS好题)

639 - Don't Get RookedTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=580In chess, the rook is a piece t

2013-10-25 08:51:48 1198

原创 UVa 216 Getting in Line (全排列&枚举)

216 - Getting in LineTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=152Computer networking requires that the computer

2013-10-25 08:28:38 949

原创 HDU 4497 GCD and LCM (数论&组合数学)

部分思路来自之前的一道题(UVa 10892)。解释下这里的6是怎么来的:设L/G=(p1^r1)*(p2^r2)*(p3^r3)…(pm^rm)又设x=(p1^i1)*(p2^i2)*(p3^i3)…(pm^im)y=(p1^j1)*(p2^j2)*(p3^j3)…(pm^jm)z=(p1^k1)*(p2^k2)*(p3^k3)…(pm^km)对于某个r,i、j、k里面一定有一个是r,并且一定有一个是0,所以i,j,k有一下3种情况:r 0 0 ,有C(3,1)种r 0 r ,有C(3,

2013-10-25 00:23:34 2406

原创 NOIP2001普及组 最大公约数和最小公倍数问题

最大公约数和最小公倍数问题http://218.5.5.242:9018/JudgeOnline/problem.php?id=1111时间限制: 1 Sec  内存限制: 128 MB题目描述  输入二个正整数x0,y0(2  条件:    1、P,Q是正整数  2、要求P,Q以x0为最大公约数,以y0为最小公倍数。  试求:满足条件的

2013-10-24 23:28:41 3745

原创 UVa 839 Not so Mobile (DFS二叉树)

839 - Not so MobileTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=780Before being an ubiquous communica

2013-10-24 19:31:40 980

原创 UVa 10562 Undraw the Trees (二叉树先序遍历)

10562 - Undraw the TreesTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=1503Professor Homer has been rep

2013-10-24 16:11:35 1194

原创 UVa 11234 Expressions (二叉树重建&由叶往根的层次遍历)

思路:1. 怎么建树?——对于给出的序列, 从左到右遍历,遇到代表数字的小写则建立一个无儿子的树(只保存值),然后把结点指针入栈;遇到代表操作符的大写字母,则从栈中弹出两个结点,然后建立一个以大写字母为根,弹出的两个节点为左右儿子的树,再把这个新树的根结点指针压入栈。如此循环下去。 最后,在栈顶的那个指针就是最后建成的树的根结点。 2. 怎么遍历输出?——模拟queue进行bfs扫描整棵树,扫描完成后逆序输出即可。完整代码:

2013-10-24 10:38:50 1366

原创 POJ 1835 宇航员 (模拟&三维向量旋转)

宇航员http://poj.org/problem?id=1835Time Limit: 2000MSMemory Limit: 30000KDescription问题描述:   宇航员在太空中迷失了方向,在他的起始位置现在建立一个虚拟xyz坐标系,称为绝对坐标系,宇航员正面的方向为x轴正方向,头顶方向为z轴正方向,则宇航员的初始状态如下

2013-10-24 00:23:07 3114

原创 POJ 1780 Code (十进制格雷码&欧拉回路)

Codehttp://poj.org/problem?id=1780Time Limit: 1000MSMemory Limit: 65536KDescriptionKEY Inc., the leading company in security hardware, has developed a new kind of safe. To

2013-10-23 23:55:53 1123

原创 UVa 540 Team Queue (STL list&queue模拟插队)

思路:1. 怎么识别某个人所在team在队中的位置(想想你插队时是不是要找熟人)?——把每个人的编号对应到一个数字(team的编号)。2. 怎么构建这个数据结构?——注意到无论怎么插队,每个team都是在一块的,是一个单独的queue,而整个team群是一个list(选择list是因为要从头遍历队列查找所在team,并且还有删除某个team的操作),所以用list<queue<int> >完整代码:

2013-10-22 22:56:32 2360 1

原创 UVa 11111 Generalized Matrioshkas (栈)

11111 - Generalized MatrioshkasTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=103&page=show_problem&problem=2052Vladimir worked for y

2013-10-22 20:48:56 805

原创 UVa 10152 ShellSort (想法题)

10152 - ShellSortTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=103&page=show_problem&problem=1093He made each turtle stand on another

2013-10-22 19:41:57 1171 3

原创 UVa 133 The Dole Queue (模拟循环链表)

133 - The Dole QueueTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=103&page=show_problem&problem=69In a serious attempt to downsize (r

2013-10-22 09:55:28 1201

原创 UVa 10785 The Mad Numerologist (排序)

10785 - The Mad NumerologistTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=1726Numerology is a science that

2013-10-22 08:31:33 778

原创 UVa 10194 Football (aka Soccer) (模拟)

10194 - Football (aka Soccer)Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=1135The ProblemFootball t

2013-10-21 22:36:29 998

原创 UVa 123 Searching Quickly (使用STL replace进行字符串替换)

123 - Searching QuicklyTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=59BackgroundSearching and sorti

2013-10-21 21:00:09 1078

原创 UVa 400 Unix ls (字符串排序&规格化输出)

400 - Unix lsTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=341The computer company you work for is intro

2013-10-21 18:25:47 1320

原创 UVa 156 Ananagrams (用STL multimap&set处理字典中的重复元素)

思路:先用建立一个multimap<排序的词,未排序的词>来处理输入,完毕后将只有一个值的键放入一个set中,最后遍历set输出即可。(详见代码)完整代码:

2013-10-21 17:36:49 1919

原创 UVa 755 / POJ 1002 / East Central North America 1999 487--3279 (排序)

755 - 487--3279Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=696http://poj.org/problem?id=1002Busine

2013-10-21 14:40:00 1641

原创 UVa 120 Stacks of Flapjacks (STL deque&reverse)

120 - Stacks of FlapjacksTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=56BackgroundStacks and Queues

2013-10-21 13:31:37 925

原创 UVa 152 Tree's a Crowd (暴力)

152 - Tree's a CrowdTime limit: 3.000 secondsDr William Larch, noted plant psychologist and inventor of the phrase ``Think like a tree--Think Fig'' has invented a new classification system for t

2013-10-21 09:36:57 1089

原创 UVa 10420 List of Conquests (STL map)

10420 - List of ConquestsTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=1361In Act I, Leporello is tellin

2013-10-21 08:33:44 1118

原创 UVa 10494 If We Were a Child Again (高精度)

10494 - If We Were a Child AgainTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=97&page=show_problem&problem=1435“Ooooooooooooo

2013-10-21 08:03:00 895

空空如也

空空如也

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

TA关注的人

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