欢迎访问我的个人网站==》 jiashubing.cn
摘要: Knight MovesTime Limit:2 Seconds Memory Limit:65536 KBA friend of you is doing research on theTraveling Knight Problem (TKP)where you are to find the shortest closed tour of knight moves that visits each square of a given set ofnsquares on a chessboard exactly once. He thinks that the most difficult 阅读全文
posted @ 2013-07-25 01:15 贾树丙 阅读(755) 评论(0) 推荐(0)
摘要: 又是类似骑士拯救公主,不过这个是朋友拯救天使的故事。。。不同的是,天使有多个朋友,而骑士一般单枪匹马比较帅~求到达天使的最短时间,杀死一个护卫1 units time , 走一个格子 1 unit time 。SO,杀死一个护卫到达那个格子 2units time。第一反应是广搜,就搜咧 = =。。WA了,交hdu上 AC了,hdu数据真弱啊。。。想了想,想通了,因为一般广搜的话必须都是1个时间才能搜,才能保证这个BFS树是等距离向外伸展的,而这个不是等距离的,所以需要一些处理。1、我的方法是,找到天使后,把时间比下大小,最后输出最小的。需要优化,只这么做的话,会TLE的,如果走过一个格子,这 阅读全文
posted @ 2013-07-22 18:18 贾树丙 阅读(287) 评论(0) 推荐(0)
摘要: CALCULATOR CONUNDRUMAlice got a hold of an old calculator that can displayndigits. She was bored enough to come up with the following time waster.She enters a numberkthen repeatedly squares it until the result overflows. When the result overflows, only thenmostsignificant digits are displayed on the 阅读全文
posted @ 2013-07-20 19:02 贾树丙 阅读(675) 评论(2) 推荐(1)
摘要: Open Credit SystemIn an open credit system, the students can choose any course they like, but there is a problem. Some of the students are more senior than other students. The professor of such a course has found quite a number of such students who came from senior classes (as if they came to attend 阅读全文
posted @ 2013-07-20 18:49 贾树丙 阅读(356) 评论(1) 推荐(1)
摘要: Age SortYou are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very simple task of sorting all the ages in ascending order.InputThere are multiple test cases in the input 阅读全文
posted @ 2013-07-20 18:12 贾树丙 阅读(526) 评论(1) 推荐(0)
摘要: NetworkConsider a tree network withnnodes where the internal nodes correspond to servers and the terminal nodes correspond to clients. The nodes are numbered from 1 ton. Among the servers, there is an original serverSwhich provides VOD (Video On Demand) service. To ensure the quality of service for 阅读全文
posted @ 2013-07-20 18:05 贾树丙 阅读(540) 评论(1) 推荐(0)
摘要: Help is needed for DexterTime Limit: 3 SecondDexter is tired of Dee Dee. So he decided to keep Dee Dee busy in a game. The game he planned for her is quite easy to play but not easy to win at least not for Dee Dee. But Dexter does not have time to spend on this silly task, so he wants your help.Ther 阅读全文
posted @ 2013-07-20 15:25 贾树丙 阅读(427) 评论(1) 推荐(0)
摘要: Easy Problem from Rujia Liu?Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets easy problem (for example, 'the Coco-Cola Store&# 阅读全文
posted @ 2013-07-19 23:06 贾树丙 阅读(456) 评论(1) 推荐(0)
摘要: I Can Guess the Data Structure!There is a bag-like data structure, supporting two operations:1 xThrow an element x into the bag.2Take out an element from the bag.Given a sequence of operations with return values, you're going to guess the data structure. It is a stack (Last-In, First-Out), a que 阅读全文
posted @ 2013-07-19 22:44 贾树丙 阅读(458) 评论(1) 推荐(0)
摘要: strcmp() Anyone?strcmp() is a library function in C/C++ which compares two strings. It takes two strings as input parameter and decides which one is lexicographically larger or smaller: If the first string is greater then it returns a positive value, if the second string is greater it returns a nega 阅读全文
posted @ 2013-07-19 22:24 贾树丙 阅读(446) 评论(1) 推荐(0)
摘要: Remember the WordNeal is very curious about combinatorial problems, and now here comes a problem about words. Knowing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie.Since Jiejie can't remember numbers clearly, he just uses sticks to help himself. Allowin 阅读全文
posted @ 2013-07-19 21:50 贾树丙 阅读(698) 评论(1) 推荐(0)
摘要: Beijing GuardsBeijing was once surrounded by four rings of city walls: the Forbidden City Wall, the Imperial City Wall, the Inner City Wall, and finally the Outer City Wall. Most of these walls were demolished in the 50s and 60s to make way for roads. The walls were protected by guard towers, and th 阅读全文
posted @ 2013-07-19 01:48 贾树丙 阅读(524) 评论(0) 推荐(0)
摘要: PieMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a numberNof them, of various tastes and of various sizes.Fof my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since tha 阅读全文
posted @ 2013-07-19 01:23 贾树丙 阅读(555) 评论(0) 推荐(0)
摘要: A Different TaskThe (Three peg) Tower of Hanoi problem is a popular one in computer science. Briefly the problem is to transfer all the disks from peg-Ato peg-Cusing peg-Bas intermediate one in such a way that at no stage a larger disk is above a smaller disk. Normally, we want the minimum number of 阅读全文
posted @ 2013-07-19 00:55 贾树丙 阅读(602) 评论(0) 推荐(0)
摘要: Even ParityWe have a grid of sizeNxN. Each cell of the grid initially contains a zero(0) or a one(1).Theparityof a cell is the number of 1s surrounding that cell. A cell is surrounded by at most 4 cells (top, bottom, left, right).Suppose we have a grid of size4x4:1010The parity of each cell would be 阅读全文
posted @ 2013-07-18 21:05 贾树丙 阅读(327) 评论(0) 推荐(0)