• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
LyonLys
愿意在角落唱沙哑的歌 再大声也都是给你 请用心听 不要说话 Contact me via E-mail: lyon.lys@gmail.com
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 35 下一页
2012年9月10日
hdu 4286 Data Handler
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4286 到了大型比赛,就算是再水的模拟题都是神模拟。。。这是2012天津网络赛的模拟题。 这题是模拟一个链表的指针移动,插入或删除结点,以及倒置指针间的数据顺序。直接一个双向链表就解决问题了! 这道模拟还算简单,虽然打了快300行,不过是很容易1y的题。代码如下:View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cassert> 4 #include <map> 5 #include & 阅读全文
posted @ 2012-09-10 13:03 LyonLys 阅读(549) 评论(0) 推荐(0)
hdu 4277 USACO ORZ
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4277 暴力dfs全部情况,然后用set去重。。。。 刚开始的时候打算用状态压缩,先从所有枝条中找到其中两组枝条,枚举全部情况。不过这种方法搜索要15 * 9E7次,一个case就超时了。后来改成枚举3^15种状态的状态压缩,3^15是不超时的,不过统计的时候每种状态统计15次,这就完蛋了!刚开始的时候没有意识到这样的问题,而且状态压缩我也打的不多,所以没有什么时候该用什么时候不该的意识,所以一直TLE都没有找到原因。最后一次代码,在dfs的时候同时统计三条边,然后在用完所有边后用set来统计(或者has.. 阅读全文
posted @ 2012-09-10 01:22 LyonLys 阅读(276) 评论(0) 推荐(0)
2012年9月9日
hdu 4278 & 4279 题解
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4278八进制转十进制:View Code 1 #include <cstdio> 2 3 int st[10], top; 4 5 int deal(int a){ 6 int ret = 0; 7 8 top = 0; 9 while (a){10 st[top++] = a % 10;11 a /= 10;12 }13 while (top--){14 if (st[top] > 8) st[top] -= 2... 阅读全文
posted @ 2012-09-09 21:16 LyonLys 阅读(219) 评论(0) 推荐(0)
hdu 4267 A Simple Problem with Integers
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4267 一道加强版的树状数组题,利用题目的关键点——除数较小,可以想到将除数跟余数分类,最多分成55种情况,也就是每个结点存放55个数据的的树状数组。 建树相对简单,遵循思路,直接构建【区间修改,单点查询】的树状数组。就是query的时候比较难想懂,不过明白构树的原理,反过来就可以知道query时要查询那些数据了。在query的时候,只需要将查询的点除以除数得到余数,然后对被查询的数、除数以及余数相应的位置进行树状数组的叠加操作,最后输出结果即可。1y代码:View Code 1 //hdu 4267 ... 阅读全文
posted @ 2012-09-09 00:44 LyonLys 阅读(198) 评论(0) 推荐(0)
2012年9月8日
hdu 4268 Alice and Bob(STL版)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4268 这是今天网络赛的水题,下午短路了,没想到怎么做。队友hq是用treap做的,不过赛后我才想懂怎么做,回到宿舍快速打了一个,立马就一个1y了。。。。 这题跟以前做的数星星十分相似,转化过去其实就是在指定坐标与其左下方的点匹配。我用线段树做,如果自己打数据结构,可以用treap,也可以直接利用multi_set来当treap用。这题的时限挺长的,所以用了大量的STL都没超时。3000ms+的代码:View Code 1 #include <cstdio> 2 #include <cstr 阅读全文
posted @ 2012-09-08 20:20 LyonLys 阅读(379) 评论(0) 推荐(0)
poj 2104 K-th Number && poj 2761 Feed the dogs
摘要: http://poj.org/problem?id=2104http://poj.org/problem?id=2761 这是一道划分树的题目,说白了就是线段树的变种。在百度文库找到相关的文章,我花了整整一个晚上才把这个变种线段树搞懂。虽然划分树只能查询区间K大值,功能局限较大,不过作为一个挺好写的算法,它还是有它的实用价值的!刚开始理解这种数据结构的构造并不难,可是在query的时候会遇到几个相对棘手的问题,这也是相当关键的问题。对着图的划分方法,很容易就想到如何query,不过在这个时候必须要思维清晰,能够深入理解query中每一个值是怎么来的。 在query中,如果要继续划分下去,直.. 阅读全文
posted @ 2012-09-08 02:30 LyonLys 阅读(232) 评论(0) 推荐(0)
2012年9月6日
poj 1090 Chain
摘要: http://poj.org/problem?id=1090 简单格雷码加大数,最近想先看书,所以有空只是拿这些水题来练练手......View Code 1 #include <cstdio> 2 #include <cstring> 3 4 const int mod = 1000000000; 5 int ans[40], dg; 6 bool r[1005]; 7 8 void db(bool add){ 9 for (int i = 0; i < dg; i++){10 ans[i] <<= 1;11 }12 if (add){13 ... 阅读全文
posted @ 2012-09-06 01:16 LyonLys 阅读(222) 评论(0) 推荐(0)
2012年9月4日
hdu 1496 Equations
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1496 上一题hash的升级版,不过还是简单题..只能当作是练手了...View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 const int maxn = 50007; 6 int hash[maxn], cnt[maxn]; 7 int tx[101]; 8 9 void pre(){10 for (int i = 1; i <= 100; i++){11 tx[i 阅读全文
posted @ 2012-09-04 12:26 LyonLys 阅读(145) 评论(0) 推荐(0)
2012年9月2日
poj 2785 4 Values whose Sum is 0
摘要: http://poj.org/problem?id=2785 简单hash,不过不能用set,而且数组不能开太大。 才几十行的代码,当时个人赛居然不会... - -View Code 1 #include <cstdlib> 2 #include <cstring> 3 #include <cstdio> 4 5 using namespace std; 6 7 const int maxn = 4001; 8 const int mod = 15999997; 9 int hash[maxn * maxn], cnt[maxn * maxn];10 int 阅读全文
posted @ 2012-09-02 00:38 LyonLys 阅读(130) 评论(0) 推荐(0)
2012年8月31日
poj 2828 Buy Tickets
摘要: http://poj.org/problem?id=2828 个人选拔的时候的题目,今天看来是水的不得了啊!~不过因为忘记换行了,搞了两个PE回来....囧...以后会注意的了。 题目意思不难明白,不过用线段树写要将数据倒过来处理,这样才能得到目标队列!View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 #define lson l, m, rt << 1 6 #define rson m + 1, r, rt << 1 | 1 7 8 阅读全文
posted @ 2012-08-31 18:38 LyonLys 阅读(161) 评论(0) 推荐(0)
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 35 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3