上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 47 下一页

2014年1月17日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4190二分答案#include using namespace std ;int a[500005] ;int main(){ int n,b ; while(~scanf("%d%d",&n,&b),n!=-1) { int maxn=-1 ; for(int i=0 ;i>1 ; int sum=0 ; for(int i=0 ;ib) left=mid+1 ; e... 阅读全文
posted @ 2014-01-17 22:16 LegendaryAC 阅读(158) 评论(0) 推荐(0) 编辑

2014年1月7日

摘要: 弱者到底为何战斗——构造一组数据,看我cha遍全场 阅读全文
posted @ 2014-01-07 02:01 LegendaryAC 阅读(138) 评论(0) 推荐(0) 编辑

2014年1月5日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3378规则去玩三国杀就理解了纯模拟注意的点:有已经分出胜负但还在杀的情况出现,所以要每次杀操作前判断是否分出胜负,如果已经分出胜负了就continue,不用接着往下操作#include #include #include using namespace std ;int n ;typedef struct L{ char js[5] ; int al ; int esc ; int sc ;}L ;L kk[101] ;int pk ;int bjnj,wnj ;int ok(){ ... 阅读全文
posted @ 2014-01-05 04:27 LegendaryAC 阅读(275) 评论(0) 推荐(0) 编辑

2013年12月29日

摘要: http://oj.luogu.org:8888/problemshow.php?pid=1992水题,yes和no大小写的问题wa了10分钟没看出来,果然该去睡觉了。。问图是否存在环,标号法,dfs把所有点搜一遍,方法见白书P111拓扑排序感觉他们这题出的真逗,最后还乱入个快速幂,OTZ#incl... 阅读全文
posted @ 2013-12-29 14:00 LegendaryAC 阅读(227) 评论(0) 推荐(0) 编辑
 
摘要: 点开题->断开连接->再也上不去->我玩NM 阅读全文
posted @ 2013-12-29 01:47 LegendaryAC 阅读(206) 评论(0) 推荐(0) 编辑

2013年12月28日

摘要: http://codeforces.com/problemset/problem/369/C树的遍历,dfs搜一下,从根节点搜到每个分叉末尾,记录一下路况,如果有需要修复的,就把分叉末尾的节点加入答案10w个点要用邻接表存图#include using namespace std ;typedef struct L{ int s,t ; int v ; int nxt ; }L ;L e[200005] ;int head[100005] ;int cnt ;void ins(int s,int t,int v){ e[cnt].t=t ; e[cnt].v=(v... 阅读全文
posted @ 2013-12-28 23:42 LegendaryAC 阅读(211) 评论(0) 推荐(0) 编辑

2013年12月26日

摘要: http://61.187.179.132/JudgeOnline/problem.php?id=1588splay,一种功能超级强大的数据结构,且较易实现,核心操作是旋转求前驱后继#include #include using namespace std ; const int maxn=100005 ;const int INF=0xfffffff ;int son[maxn][2],fa[maxn],key[maxn] ;int rt,size ;void link(int x,int y,int k)//将x连到y的k儿子上 0左1右 { fa[x]=y ; son[y][... 阅读全文
posted @ 2013-12-26 18:38 LegendaryAC 阅读(449) 评论(0) 推荐(0) 编辑

2013年12月20日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1374已知三点坐标,求三点确定的圆的周长#include #include #include using namespace std ;//由正弦定理 sin90°/d=sinA/a 既d=a/sinA //s=1/2(bcsinA) 既sinA=2s/bc //由海伦公式 s=sqrt(p(p-a)(p-b)(p-c)),p=(a+b+c)/2 #define PI 3.141592653589793int main(){ double x1,y1,x2,y2,x3,y3 ; while(~sc. 阅读全文
posted @ 2013-12-20 14:47 LegendaryAC 阅读(151) 评论(0) 推荐(0) 编辑

2013年12月18日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3345最近重写usaco压力好大,每天写的都想吐。。水一道bfs注意的是开始旁边有敌人可以随便走,但是一旦开始走,再与敌人相邻行动力就变为0#include #include #include #include #include #include #include using namespace std ;char map[101][101] ;char ans[101][101] ;int vis[101][101] ;int n,m,MV ;typedef struct L{ int x,y ; ... 阅读全文
posted @ 2013-12-18 22:51 LegendaryAC 阅读(225) 评论(0) 推荐(0) 编辑

2013年12月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2089基础的数位dp,当初不懂数位dp水过去的,今天重新写一下,解释看注释预处理+递推学自http://wenku.baidu.com/view/9de41d51168884868662d623.html#include using namespace std ;int f[8][10] ;//f[i][j]表示第i位是数j时符合条件的数字数量 int digit[9] ;//digit[i]表示n从右到左第i位是多少 void Init(){ f[0][0]=1 ; for(int i=1 ;... 阅读全文
posted @ 2013-12-13 17:37 LegendaryAC 阅读(2413) 评论(5) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 47 下一页