PmPen

----专注于Lamp技术
  管理

随笔分类 -  算法数据结构

摘要:Exponentiation指数DescriptionProblems involving涉及 the computation计算of exact values of very large magnitude级and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems. This problem requires that you write a program to compute the exact v 阅读全文

posted @ 2011-03-08 22:04 PmPen 阅读(396) 评论(0) 推荐(0)

摘要:最近做了一道关于约瑟夫的问题,之后参考书上面的讲解,书上说还有更高效且节省存储空间的算法。硬是想不出于是百度一下,看了很多人的的高见。结果以我这种菜鸟级的水平看了大半天硬是没看明白。现在我似乎明白了一些,特写下这篇“菜鸟看约瑟夫”。 文章首先是我从百度百科上找到的约瑟夫问题的数学方法的资料,之后是才是本人在此基础上,以“鸟语”的形式表达个人思想。 Josephus(约瑟夫)问题的数学方法 无论是用链表实现还是用数组实现都有一个共同点:要模拟整个游戏过程,不仅程序写起来比较烦,而且时间复杂度高达O(nm),当n,m非常大(例如上百万,上千万)的时候,几乎是没有办法在短时间内出结果的。我们注意.. 阅读全文

posted @ 2011-02-13 18:35 PmPen 阅读(439) 评论(1) 推荐(1)

摘要:487-3279Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 151053Accepted: 25753DescriptionBusinesses like to have memorable telephone numbers(容易被记住的电话号码). One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of W 阅读全文

posted @ 2011-02-09 15:15 PmPen 阅读(416) 评论(0) 推荐(0)

摘要:Digital RootsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 19968Accepted: 6563DescriptionThe digital (数字)root (根)of a positive integer is found by summing the digits of the integer. If the resulting (结果)value is a single digit then that digit is the digital root. If the resulting value co 阅读全文

posted @ 2010-12-11 15:04 PmPen 阅读(383) 评论(0) 推荐(0)

摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 44052Accepted: 15768DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一个人可以从某个点滑向上下... 阅读全文

posted @ 2010-12-07 21:42 PmPen 阅读(586) 评论(0) 推荐(0)