09 2017 档案
摘要:A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least on...
阅读全文
摘要:Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers ...
阅读全文
摘要:Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers ...
阅读全文
摘要:给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素...
阅读全文
摘要:1063. Set SimilarityGiven two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of dist...
阅读全文
摘要:1060. Are They Equal If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since t...
阅读全文
摘要:汉诺塔问题是一个经典的递归问题,大意是:有A, B, C三根柱子,A柱上有n个盘子,小的在上,大的在下,现在要在B柱的帮助下将A柱上的所有盘子移动到C柱上,而且要求每次只能移动一个,并且任何时候小的盘子只能在大的盘子上面。 利用递归逐步分解问题的思想可以轻松解决这道题。首先考虑只有一个圆盘(n=0)
阅读全文
摘要:1059. Prime Factors Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…
阅读全文
摘要:1058. A+B in HogwartsIf you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid expl...
阅读全文
摘要:1057. StackStack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basi...
阅读全文
摘要:1056. Mice and RiceMice and Rice is the name of a programming contest in which each programmer must write a piece of code to control t...
阅读全文
摘要:1080. Graduate AdmissionIt is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zh...
阅读全文
摘要:1079. Total Sales of SupplyA supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in...
阅读全文