递归
文章平均质量分 69
menxiaoyuan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Number Sequence
Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).原创 2015-10-30 08:50:28 · 363 阅读 · 0 评论 -
Digital Roots
Problem Description The 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 result原创 2015-10-30 08:56:09 · 371 阅读 · 0 评论 -
已知先序和中序求后序或中序和后序求先序
首先介绍树的三种遍历方式的遍历顺序: 先序遍历:根、左子树、右子树(特点:第一个元素为根) 中序遍历:左子树、根、右子树(特点:根的两边分别为左子树和右子树) 后序遍历:左子树、右子树、根(特点:最后一个元素为根) 有如下图的二叉树: 其先序、中序、后序遍历分别为:DBACEGF、ABCDEFG、ACBFGED。 1、已知先序和中序求后序 先序遍历的第一个字符为根,因此只需在原创 2015-11-19 18:48:22 · 2613 阅读 · 2 评论 -
非常可乐
Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S Input 三个整数 : S 可乐的体积 , N 和 M原创 2015-11-01 16:54:12 · 411 阅读 · 0 评论
分享