由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 一道关于两倍年龄的题目 (转载)
相关主题
请教一道Leetcode 题, 多谢有好的merge有序数组算法么
请教leetcode一道题什么也不管了,给了一个烙印很差的feedback
请教一个数论的问题Divide Two Integers
amazon phone interviewreverse an integer 怎么判断是否 overflow 来着
问一道题问一道leetcode的题
请教那个scramble string的题目求大数加1题目的细节
onsite完,攒rp系列(二)求教一个, Leetcode 题.
请问如何安全地reverse 一个integer问个简单的atoi的问题
相关话题的讨论汇总
话题: let话题: age话题: floor话题: 年龄话题: therefore
进入JobHunting版参与讨论
1 (共1页)
M*****y
发帖数: 666
1
【 以下文字转载自 Quant 讨论区 】
发信人: MsPiggy (coconut), 信区: Quant
标 题: 一道关于两倍年龄的题目
发信站: BBS 未名空间站 (Thu Mar 11 19:32:14 2010, 美东)
有没有高手来说说这道题怎么讨论?
两个人,A,B. A的年龄比B大。
For what length of time in their lives will A's age be twice B's age? (此处
的年龄说的是 truncated integer age). 还有一个assumption是两个人都可以无限地
活下去。
假设不限定具体的年龄数,该如何讨论这道题目呢?多谢!
我自己觉得无论A,B多少岁,这个问题的答案始终是1年
不知道对不对,有什么合理的讨论方法
l***8
发帖数: 149
2
Let set T = {t | 2 * floor(t) == floor(t + A.age - B.age)}
Let c = floor(A - B), d = (A - B) - c
Then T = {t | (t >= c && t < c + 1 - d) || (t >= c + 2 - d && t < c + 2)}.
Therefore the measure of T is 1.
M*****y
发帖数: 666
3
Thanks!!!! That makes a lot of sense!

【在 l***8 的大作中提到】
: Let set T = {t | 2 * floor(t) == floor(t + A.age - B.age)}
: Let c = floor(A - B), d = (A - B) - c
: Then T = {t | (t >= c && t < c + 1 - d) || (t >= c + 2 - d && t < c + 2)}.
: Therefore the measure of T is 1.

f**r
发帖数: 865
4
what does it mean by "truncated integer age"? does that mean the age could
overflow?
M*****y
发帖数: 666
5
it means if my age now is 27 and next month on my birthday, my age will
become 28

【在 f**r 的大作中提到】
: what does it mean by "truncated integer age"? does that mean the age could
: overflow?

1 (共1页)
进入JobHunting版参与讨论
相关主题
问个简单的atoi的问题问一道题
Linked电面分享,挺好的题 应该已挂请教那个scramble string的题目
请大家谈谈应对简单题目的策略吧onsite完,攒rp系列(二)
有人面过linkedin,比google amazon 题目怎么样?请问如何安全地reverse 一个integer
请教一道Leetcode 题, 多谢有好的merge有序数组算法么
请教leetcode一道题什么也不管了,给了一个烙印很差的feedback
请教一个数论的问题Divide Two Integers
amazon phone interviewreverse an integer 怎么判断是否 overflow 来着
相关话题的讨论汇总
话题: let话题: age话题: floor话题: 年龄话题: therefore