08 2011 档案

摘要:1、棋子反转偶数次相当于没有反转,反转奇数次相当于反转一次,所以状态空间数量极为2^16次,遍历搜索即可;2、对于暴力求解问题是,一定要注意存在的重叠子结构,使用数组存储可以减少搜索时间;3、BFS存储时,要确定存储的信息,尽量少存储,减少浪费;4、通过恰当的编码实现可以压缩空间; 阅读全文
posted @ 2011-08-31 23:58 天堂一梦 阅读(111) 评论(0) 推荐(0) 编辑
摘要:Couple things to remember:Remove all the test codes before submit it. This sounds silly but I've done it couple of times.Read the problem statement carefully, as some of them are vague intentionally. e.g. In the poker hands one, it doesn't say duplicate cards are not valid.Don't worry to 阅读全文
posted @ 2011-08-23 14:04 天堂一梦 阅读(291) 评论(0) 推荐(0) 编辑
摘要:cin<<的结束符有enter space tab,忽略相关字符继续;cin.get()的结束符只有enter,但会把enter放入队列等待,不会去掉回车符;cin.getline()的结束符也只有enter,但不会把enter放入队列,去除回车符后将之放入string中;如果用cin>>…做过输入,在使用cin.getline之前,需要处理一下。处理的方法很多,你可以在cin>>…的输入语句后加一个语句cin.get();。 阅读全文
posted @ 2011-08-14 15:59 天堂一梦 阅读(343) 评论(0) 推荐(1) 编辑