• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
LyonLys
愿意在角落唱沙哑的歌 再大声也都是给你 请用心听 不要说话 Contact me via E-mail: lyon.lys@gmail.com
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 ··· 35 下一页
2013年12月18日
BUAA 169 电话费
摘要: http://oj55.bianchengla.com/problem/169/ 还有这个,不怎么好做,最后用栈做出来了。感觉比较有用的一个数据是:10 31010101010代码如下: 1 #include 2 #include 3 4 using namespace std; 5 6 const int N = 11111; 7 int n, k; 8 char s[N], stk[N], mx[N]; 9 10 int main() {11 while (~scanf("%d%d%s", &n, &k, s)) {12 int top = -1;13 阅读全文
posted @ 2013-12-18 18:15 LyonLys 阅读(174) 评论(0) 推荐(0)
BUAA 623 Chem is Try!
摘要: http://oj55.bianchengla.com/problem/623/ 好久没写过题解了,昨天做了一道挺恶心的题目,贴一下代码上来。看了一下提交状况,好像我的代码挺短的了,至少我找不到比我短的代码。RE1,AC。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 using namespace std; 10 11 const int N = 111111; 12 char buf[N], *p[2]; 13 typedef ... 阅读全文
posted @ 2013-12-18 18:08 LyonLys 阅读(219) 评论(0) 推荐(0)
2013年9月27日
hdu 1077 (圆交)
摘要: Problem - 1077 我们可以知道,当这个单位圆可以覆盖到最多的点的时候,必定最少有两个点位于这个圆的圆周上,于是就有网上众多的O(N^3)的枚举两个在圆上的点的暴搜做法。 然而这题是可以用圆交来做的。 我们以一条鱼的位置作为圆心,半径为1的圆的周围随便找一个点都能把这条鱼抓到。这时,我们可 阅读全文
posted @ 2013-09-27 05:27 LyonLys 阅读(911) 评论(3) 推荐(1)
2013年9月23日
hdu 4629 Burning (扫描线)
摘要: Problem - 4629 以前写过PSLG模拟的版本,今天写了一下扫描线做这题。 其实这题可以用set存线段来做,类似于判断直线交的做法。不过实现起来有点麻烦,于是我就直接暴力求交点了。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 10 using namespace std; 11 12 const double EPS = 1e-10; 13 inline int sgn(double x) { re... 阅读全文
posted @ 2013-09-23 01:45 LyonLys 阅读(395) 评论(0) 推荐(1)
2013年9月20日
SPOJ 8073 The area of the union of circles (圆并入门)
摘要: Sphere Online Judge (SPOJ) - Problem CIRU【求圆并的若干种算法,圆并扩展算法】_AekdyCoin的空间_百度空间 参考AekdyCoin的圆并算法解释,根据理解写出的代码。圆并这么多题中,最基础一题。 操作如下:(1)对一个圆,获得所有与其他圆的交点作为时间戳。 a.如果这个圆不被其他任何圆覆盖,这个圆直接保留。 b.如果Case中有两个完全重合的圆,可以保留标号小(或大)的圆,也只保留这一个。(2)每经过一个时间戳就对计数器加减,如果计数器从0变1,加上这段圆弧和对应的三角形。(3)所有这样的圆独立计算,最后求出的面积累加即可。代码如下(1y... 阅读全文
posted @ 2013-09-20 05:50 LyonLys 阅读(481) 评论(0) 推荐(0)
2013年9月10日
4818 Largest Empty Circle on a Segment (几何+二分)
摘要: ACM-ICPC Live Archive 挺水的一道题,直接二分圆的半径即可。1y~ 类似于以前半平面交求核的做法,假设半径已经知道,我们只需要求出线段周围哪些位置是不能放置圆心的即可。这样就转换为圆与直线,直线与直线交的问题了。 不知道这题能不能SAA过,有空试下。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 const double EPS = 1e-5; 11 inline int sgn(... 阅读全文
posted @ 2013-09-10 02:07 LyonLys 阅读(302) 评论(0) 推荐(0)
2013年9月2日
树状数组(Binary Index Tree)
摘要: 一维BIT(单点更新,区间求和):Problem - 1166 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int N = 111111; 9 typedef long long LL;10 inline int lowbit(int x) { return x & -x;}11 struct BIT {12 LL s[N], sz;13 void init(int n) { sz = n; for (int i = 1; i 0; x -= lowb... 阅读全文
posted @ 2013-09-02 23:13 LyonLys 阅读(406) 评论(0) 推荐(0)
hdu 4128 Running relay (线性规划转半平面交)
摘要: Problem - 4128 对偶线性规划转半平面交,这题的正解O(nlogn)解法,目前网上没有找到这样的正解。 原来的不等式组,sigma{-si*xi}>=-W+d*sigma{si}sigma{xi}>=L-n*dsigma{-xi}>=-L+n*dxi>=0T=sigma{ti*xi}+d*sigma{ti},求Min(T)。 用线性规划对偶性,变成了-si*x+y=0,y无限制T'=(-W+d*sigma(si))*x+(L-nd)*y+d*sigma{ti},求Max(T')。——written by Lyon 阅读全文
posted @ 2013-09-02 11:55 LyonLys 阅读(413) 评论(1) 推荐(0)
2013年8月21日
LA 4676 Geometry Problem (几何)
摘要: ACM-ICPC Live Archive 又是搞了一个晚上啊!!! 总算是得到一个教训,误差总是会有的,不过需要用方法排除误差。想这题才几分钟,敲这题才半个钟,debug就用了一个晚上了!TAT 有一定几何基础的很容易想到这里的碰撞一定是其中一个顶点撞到另一个三角形的边上,于是就可以暴力枚举每一个顶点的最先碰撞的时间。注意的是,求直线相交以后,判交点是否在线段内,对于1e7的数据,千万不要判点在线上!TAT 因为已经知道是交点了,只要判断是不是在两点之间就好了。代码如下:(把onseg改少了一个判断就过了) 1 #include 2 #include 3 #include 4 #... 阅读全文
posted @ 2013-08-21 23:00 LyonLys 阅读(230) 评论(0) 推荐(0)
2013年8月18日
ural 1519 Formula 1(插头dp)
摘要: 1519. Formula 1 @ Timus Online Judge 干了一天啊!!!插头DP入门。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 typedef long long LL; 10 11 const int N = 15; 12 const int M = 1666666; 13 LL pw[N], dp[2][M]; 14 int stk[2][M], top[2]; 15 char ma... 阅读全文
posted @ 2013-08-18 21:32 LyonLys 阅读(242) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 35 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3