摘要: 就是建图,把题目描述的东东转换成一张图求最短路就行了,因为是随机询问,所以用floyd比较方便。不过打完之后一直WA,百思不得其解的情况下看了一下discuss,有人说得用long long,于是我马上改了交,果然过了……唉,以后看题还是得细心……/* * hdu1690/win.cpp * Created on: 2012-10-27 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime&g 阅读全文
posted @ 2012-10-27 21:17 moonbay 阅读(171) 评论(0) 推荐(0)
摘要: 这题还是挺不错的,第一个突破点就是n很大但是m很小,所以能组成的集合最多有2^14种的,枚举这每一种能否构成即可。刚开始的时候是用set存每一个数的,超时,略加改进,用位存储就过掉了。不过我还是算蹭过的,600多ms,应该还能继续用位运算优化。/* * hdu3306/win.cpp * Created on: 2012-10-27 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime> 阅读全文
posted @ 2012-10-27 14:23 moonbay 阅读(145) 评论(0) 推荐(0)
摘要: 刚看的时候还以为挺难的,试了一下最水的方法,居然过了。就是从N以后往下试,试到smith数停止就行,而且对于smith数的判断也可以简单处理,循环到sqrt(n)即可,唉,这种简单方法我这次现场赛咋没想到呢……/* * hdu1333/win.cpp * Created on: 2012-10-27 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iost 阅读全文
posted @ 2012-10-27 12:27 moonbay 阅读(200) 评论(0) 推荐(0)