• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
LyonLys
愿意在角落唱沙哑的歌 再大声也都是给你 请用心听 不要说话 Contact me via E-mail: lyon.lys@gmail.com
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 35 下一页
2013年3月27日
hdu 1195 Open the Lock
摘要: Problem - 1195 一个全排列的搜索题,开始的时候看错题,没发觉是两个相邻的数才可以交换。计算交换次数可以用冒泡排序来模拟,从而算两个状态间要多少次交换才能达到。代码如下:View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <algorithm> 5 6 using namespace std; 7 8 #define REP(i, n) for (int i = 0; i < (n); i++) 9 #define 阅读全文
posted @ 2013-03-27 01:08 LyonLys 阅读(137) 评论(0) 推荐(0)
2013年3月22日
hdu 2527 Safe Or Unsafe
摘要: Problem - 2527 水题一枚,轻松通过。代码如下:View Code 1 #pragma comment(linker, "/STACK:102400000,102400000") 2 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <vector> 7 #include <algorithm> 8 #include <set> 9 #include <iostream>10 #inc 阅读全文
posted @ 2013-03-22 23:59 LyonLys 阅读(197) 评论(0) 推荐(0)
hdu 4514 湫湫系列故事——设计风景线(树DP)
摘要: Problem - 4514 这是今晚的腾讯第三场初赛题中的1005。虽然我没有参加这场比赛,不过我还是尝试做了一下今晚的变态题。 这道题是要你判一幅图中是否有环,有环的话就输出“YES”,没有的话就输出森林里最长的一条路径。题目是中文的,就解释这么多吧! 做法就是直接dfs,每次保存两个值,一个是子树单链的最长长度,另一个是子树中最长的完整链的长度。 不过dfs有一个问题就是会爆栈,如果不想改bfs的话就要加上栈挂。 哈哈,最意想不到的是我居然一次做就对树DP了,除了那狗血的RE。-.-代码如下:View Code 1 #pragma comment(linker, "/STAC. 阅读全文
posted @ 2013-03-22 23:09 LyonLys 阅读(435) 评论(0) 推荐(0)
2013年3月11日
hdu 2066 一个人的旅行 (dij+heap)
摘要: Problem - 2066 入门SP,用dij+heap 0ms通过。View Code 1 #define REP(i, n) for (int i = 0; i < (n); i++) 2 #define REP_1(i, n) for (int i = 1; i <= (n); i++) 3 typedef pair<LL, int> PLI; 4 #define PB push_back 5 #define MPR make_pair 6 #define FI first 7 #define SE second 8 9 VPII rel[N];10 LL di 阅读全文
posted @ 2013-03-11 10:43 LyonLys 阅读(165) 评论(0) 推荐(0)
2013年3月8日
LA 3667 Ruler
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1668 这题想了两天,两天里经历了发烧感冒,各种疲惫难堪。 因为这题在网上没有题解,只好强迫着自己去想应该怎么去搜索来解决。其实很容易就留意到答案的长度最多是7,实际上最多只需要找6个数,这个相当的关键。然后留意的一个要点是,距离是怎么测的呢?显然,一个长度是通过两个标记的距离差测出来的,所以对某个序列其中一个标记加或减这个长度,就会得到另一个标记,从而可以通过搜索 阅读全文
posted @ 2013-03-08 02:06 LyonLys 阅读(565) 评论(1) 推荐(1)
2013年3月4日
LA 4253 Archery(二分+枚举)
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2254 这题是一道没有人通过的题。 对于这题我想到一个二分的方法,可是无论怎么调精度都通过不了。个人感觉,是精度要求的比较高,所以不容易做出这样的题。分享一下代码:View Code 1 /***************** Written By Lyon, From SCAU, Beta 1.4.0 **************/ 2 /************* 阅读全文
posted @ 2013-03-04 01:02 LyonLys 阅读(479) 评论(0) 推荐(1)
2013年3月3日
LA 4636 Cubist Artwork
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2637 这题可以模拟贪心排布,也可以像我的代码一样,直接贪心。代码如下:View Code 1 #define REP(i, n) for (int i = 0; i < (n); i++) 2 3 int cnt[N]; 4 5 int main() { 6 int w, d; 7 while (~scanf("%d%d", &w 阅读全文
posted @ 2013-03-03 21:17 LyonLys 阅读(269) 评论(0) 推荐(0)
LA 4328 Priest John's Busiest Day (Greedy)
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2329 很好的一道贪心题。在贪心的时候,因为时间安排是要连续的,所以用区间的中点作为排序的依据。中点靠前的区间要先贪心,标记当前最后的时间点。View Code 1 #define REP(i, n) for (int i = 0; i < (n); i++) 2 3 struct Cerem { 4 int begin, end; 5 int len, mi 阅读全文
posted @ 2013-03-03 00:33 LyonLys 阅读(252) 评论(0) 推荐(0)
2013年3月2日
LA 4324 Ugly Windows (模拟)
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2325 考细心的模拟,开始的时候,没有注意到不能有其他窗遮盖这个条件,把模拟写成了只要能看到全部窗框就算是满足要求,所以WA了一次。不过很快就找到这个bug了,AC。 做法其实很简单,只要沿着边框走一遍就可以了。代码如下:View Code 1 #define _clr(x) memset(x, 0, sizeof(x)) 2 #define REP(i, n) f 阅读全文
posted @ 2013-03-02 02:19 LyonLys 阅读(219) 评论(0) 推荐(0)
LA 3507 Keep the Customer Satisfied (Greedy)
摘要: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1508 贪心,经典题的变形,只是变成了要消耗时间,其实还是跟经典的求最大价值相似。View Code 1 #define REP(i, n) for (int i = 0; i < (n); i++) 2 #define PRIQ priority_queue 3 typedef pair<int, int> PII; 4 typedef vect 阅读全文
posted @ 2013-03-02 01:06 LyonLys 阅读(191) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 35 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3