随笔- 509  文章- 0  评论- 151  阅读- 22万 

2014-05-10 06:51

题目链接

原题:

"How would you find the number of gas stations in the United States?" 

*You cannot look up any concrete information (like the average number of gas stations per state), but you need to yield an accurate answer.

题目:你要如何搞清楚美国有多少个加油站?不准查,不准问。

解法:这个题很出名,是外行人眼里的奇葩智力题。起初我也觉得这题就是智力题,但是读了《编程珠玑》之后明白了这题是对于估算能力的考察。个人觉得估算需要三个条件:1. 发现有关联的变量。2. 明确变量构成的公式。3. 估算各个变量的值,然后计算公式结果。我想到了人口、国土面积、人口密度、之类的变量,但是没法确定加油站的数量到底和哪一个直接相关,所以还是没有办法构造公式。参考了答案以后,算是有了个结论:加油站和人口相关。这个结论真的可靠?

代码:

复制代码
 1 // http://www.careercup.com/question?id=5680049562845184
 2 Answer:
 3     The number of gas stations is related to population, instead of area of land.
 4     Thus you have to find out the average density of gas stations by population.
 5 
 6 Here's the answer from another user:
 7     From the US census you can look up what is the average density of gas station / population ( some number ). Multiply that by the population and you get the answer. 
 8 10 gas stations / 1000 people * (300,000) = 3000 gas stations. Although this answer will be within the standard deviation and you will have to find the upper and lower limit 
 9 +- std.dev.
10     Another way would be to do data mining. Either way you need some information, you cannot pull a number out of thin air. Well, unless you travel through each and every street and corner of the country. 
11 Another great idea: gather telephone books from each and every area of the US and count the number of gas stations in each region and add them up. Not all gas stations are labelled gas stations. 
12 So, pick and choose, or maybe another idea!!
复制代码

 

 posted on   zhuli19901106  阅读(231)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示