第一题说明

应该是假定有个 map &lt int, bool &gt 来表示房间的状态,这个 map 是由别的程序建立和修改的。 问题的要求是输出所有没打扫房间的号码。这个工作要做很多次,所以要设法降低平均运算时间。

题目都是很简单的,高手应该立马就有比较好的方法。

所有跟帖: 

还是这个难阿。水平很差,想不到好办法 -feicen- 给 feicen 发送悄悄话 (296 bytes) () 05/09/2009 postreply 17:42:01

你功底蛮好的。这个 map 可以认为是每天早上建立的,这样就简单了。 -乱弹- 给 乱弹 发送悄悄话 乱弹 的博客首页 (0 bytes) () 05/09/2009 postreply 17:44:28

回复:第一题说明 -GoldIsGold- 给 GoldIsGold 发送悄悄话 (165 bytes) () 05/09/2009 postreply 17:52:05

不错不错。 -feicen- 给 feicen 发送悄悄话 (0 bytes) () 05/09/2009 postreply 17:54:16

能否详细说明一下,或者给出伪代码?学习学习 -feicen- 给 feicen 发送悄悄话 (0 bytes) () 05/09/2009 postreply 17:56:43

回复:能否详细说明一下,或者给出伪代码?学习学习 -GoldIsGold- 给 GoldIsGold 发送悄悄话 (449 bytes) () 05/09/2009 postreply 18:28:15

有待仔细考虑。尤其是对"big hotel"的case,有huge number of rooms. -戏雨飞鹰- 给 戏雨飞鹰 发送悄悄话 戏雨飞鹰 的博客首页 (66 bytes) () 05/10/2009 postreply 11:48:07

楼上2位好厉害!PF:)。 -戏雨飞鹰- 给 戏雨飞鹰 发送悄悄话 戏雨飞鹰 的博客首页 (0 bytes) () 05/09/2009 postreply 17:58:30

yeah, this is good -hello2- 给 hello2 发送悄悄话 hello2 的博客首页 (0 bytes) () 05/09/2009 postreply 18:40:40

回复:回复:第一题说明 -spear123- 给 spear123 发送悄悄话 (216 bytes) () 05/10/2009 postreply 18:06:06

能给个具体的算法吗?(或是map,或是array都可以) -戏雨飞鹰- 给 戏雨飞鹰 发送悄悄话 戏雨飞鹰 的博客首页 (0 bytes) () 05/10/2009 postreply 11:43:24

Just a sample -乱弹- 给 乱弹 发送悄悄话 乱弹 的博客首页 (499 bytes) () 05/10/2009 postreply 12:37:42

need to add "++iter" in the second case -乱弹- 给 乱弹 发送悄悄话 乱弹 的博客首页 (0 bytes) () 05/10/2009 postreply 12:39:09

xiexie. -戏雨飞鹰- 给 戏雨飞鹰 发送悄悄话 戏雨飞鹰 的博客首页 (0 bytes) () 05/10/2009 postreply 13:59:08

请您先登陆,再发跟帖!