摘要: 给定一个常数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个元素不反转。输入格式:每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址、结点... 阅读全文
posted @ 2015-03-04 21:16 Joilee 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Mice and Riceis the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given m... 阅读全文
posted @ 2015-03-04 16:27 Joilee 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given s... 阅读全文
posted @ 2015-03-04 14:45 Joilee 阅读(254) 评论(0) 推荐(0) 编辑
摘要: The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. ... 阅读全文
posted @ 2015-03-04 11:39 Joilee 阅读(224) 评论(0) 推荐(0) 编辑
摘要: A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key ... 阅读全文
posted @ 2015-03-04 01:12 Joilee 阅读(123) 评论(0) 推荐(0) 编辑