午餐时游戏的代码挑战问题
所以,我将举办一场午餐会,并且我正在寻找一项有趣的活动。我记得看过一个谷歌技术谈话视频,一开始有一系列用 C 或 C++ 编写的“这段代码会做什么”的谜题,我认为做类似的事情是个好主意。
你知道那个视频是哪个吗,因为我找不到它了?你知道有什么网站可以让我得到类似的谜题吗?如果它们是 C/C++ 语言,我会更喜欢,
谢谢:)
So, I will be hosting a lunch and I am looking for an interesting activity. I remember having seen a google tech talk video that, in the beginning, had a series of "what will this code do" puzzles in c or c++, and I thought it would be a good idea to do something similar.
Do you know which that video was, as I cannot find it again? Do you know of any site from which I could get some puzzles like that? I would prefer if they were in C/C++
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
也许不完全是你想要的,但仍然:
例如:
22*(2+2)+2*(2+2+2)
是long-气喘吁吁;(222-22)/2
很短(10 个符号),但不是最短的。或者,相同,但您应该使用
0
而不是2
;该解决方案有点长,但它存在:)我很高兴解决这个问题。Maybe not exactly what you want, but still:
For example:
22*(2+2)+2*(2+2+2)
is long-winded;(222-22)/2
is short (10 symbols) but not shortest.Or, the same, but you should use
0
instead of2
; the solution is a bit longer but it exists :) I had fun solving this stuff.弄清楚这将打印什么:
另外,请参阅这本书。
Figure out what this will print:
Also, see this book.
找到一组逻辑问题供人们推理。其中一些可能有封闭的解决方案,另一些可能开放讨论:
Find a set of logic problems for people to reason about. Some of them might have closed solutions, others might be open for discussion:
我不知道有什么网站,但这是我不久前为一场比赛写的一个网站。
假设 biguint 是一个任意精度的无符号整数类,
它会找到斐波那契数
input
,其中输入 1-10 的结果为 [1,1,2,3,5,8,13,21,34,55 ]即使使用相对愚蠢的编译器,它也非常非常快。
I don't know any sites, but here's one I wrote for a constest a while back.
Assume biguint is an arbitrary-precision unsigned integer class
It's finds the Fibonacci number
input
where inputs 1-10 result in [1,1,2,3,5,8,13,21,34,55]It's also very very fast, even with a relatively stupid compiler.