由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个面试题
相关主题
大家看看这个面试题怎么回答越找越没信心了
A家面试代码能力和oo能力,求问大牛指导有兴趣的人帮看下
也谈关于内推拿到 job offer, 可是非常纠结
M家问题请问 fresh EE master 的base salary (Update 1)
Two problems about Algorithmforward a contract job opening (medical imaging)
大牛,过来讨论一下这道题MS的intern也怎么难申请
a c++ interview question为什么facebook 给我出的题目我做出来了,还是被拒了?我做的还是buffet级别的,
请问J2可以工作吗?有什么限制没有?bloomberg 电话面试问题
相关话题的讨论汇总
话题: iavg话题: intmax话题: array话题: arithmetic话题: precision
进入JobHunting版参与讨论
1 (共1页)
K******g
发帖数: 1870
1
Write a function iavg() that accepts as arguments an array v[] of the widest
size integers supported by a computer, and the array’s size n, and
computes the integer average of the array’s values with loss of precision
less than 1 over the entire range of possible parameter values.
In C or C++ the function prototype would be:
intmax_t iavg (const intmax_t v[], const uintmax_t n)
The solution should use only integer arithmetic, without relying on any
explicit assumptions about internal number representation or the type of
machine arithmetic. Library functions may not be used.
additional questions:
How can the precision margin be narrowed to less than 0.5?
l*n
发帖数: 529
2
对每个数计算arr[i]/n 和arr[i]%n,然后分别汇总?

widest

【在 K******g 的大作中提到】
: Write a function iavg() that accepts as arguments an array v[] of the widest
: size integers supported by a computer, and the array’s size n, and
: computes the integer average of the array’s values with loss of precision
: less than 1 over the entire range of possible parameter values.
: In C or C++ the function prototype would be:
: intmax_t iavg (const intmax_t v[], const uintmax_t n)
: The solution should use only integer arithmetic, without relying on any
: explicit assumptions about internal number representation or the type of
: machine arithmetic. Library functions may not be used.
: additional questions:

1 (共1页)
进入JobHunting版参与讨论
相关主题
bloomberg 电话面试问题Two problems about Algorithm
这家公司到底想不想要我呀大牛,过来讨论一下这道题
今天收到拒信了,心痛到没办法呼吸a c++ interview question
Suggestion to get a potential offer请问J2可以工作吗?有什么限制没有?
大家看看这个面试题怎么回答越找越没信心了
A家面试代码能力和oo能力,求问大牛指导有兴趣的人帮看下
也谈关于内推拿到 job offer, 可是非常纠结
M家问题请问 fresh EE master 的base salary (Update 1)
相关话题的讨论汇总
话题: iavg话题: intmax话题: array话题: arithmetic话题: precision