上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 56 下一页
摘要: A题,每次输入的时候记录,保留上一个的值,做差判断 #include<bits/stdc++.h> #define C 0.5772156649 #define pi acos(-1.0) #define ll long long #define mod 1000000007 #define ls 阅读全文
posted @ 2017-08-22 09:33 walfy 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 可以转变成上一题(hdu1542)的形式,把每条线段变成宽为1的矩形,求矩形面积并 要注意的就是转化为右下角的点需要x+1,y-1,画一条线就能看出来了 #include<bits/stdc++.h> #define pi acos(-1.0) #define ll long long #defin 阅读全文
posted @ 2017-08-18 18:23 walfy 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 参考博客: http://blog.csdn.net/xingyeyongheng/article/details/8927732 总的来说就是用一条(假想的)线段去平行x轴从下往上扫描,扫描的过程中更新下底边的个数和长度综合(用线段树维护) 因为x的值可能会很大,所以就要用Hash表来进行离散化, 阅读全文
posted @ 2017-08-18 17:26 walfy 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 第一题花的时间有点多 A,注意考虑0,15的极端情况就好了,还有只有一个数的未知情况 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdi 阅读全文
posted @ 2017-08-18 12:56 walfy 阅读(165) 评论(0) 推荐(0) 编辑
摘要: A题有点坑,不能只用a,b,c其中一个来算(因为有可能出现a,b,c其中几个很大的情况),每次必须有a,b,c的情况 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector 阅读全文
posted @ 2017-08-17 17:56 walfy 阅读(142) 评论(0) 推荐(0) 编辑
摘要: A题有点水,但是花了10分钟才a掉,把%10的先加一,处理成字符串再减一 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #in 阅读全文
posted @ 2017-08-17 13:57 walfy 阅读(138) 评论(0) 推荐(0) 编辑
摘要: dp[i][j] 第i轮得分为j的情况sum为dp[i-1][j]的前缀和dp[i][j]= ∑dp[i-1][l](l-2*k<j,j<l+2*k) 最后枚举的时候只需要记录从0到2*k*t的dp和偏移和(即最后的sum)的乘积 #include<map> #include<set> #inclu 阅读全文
posted @ 2017-08-16 15:23 walfy 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 先floyd预处理一遍dis,枚举所有状态,dp[ i ] [ j ]表示 以 j 为终点的状态 i 使用最小的时间 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector 阅读全文
posted @ 2017-08-15 12:41 walfy 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 枚举灯的所有可能状态(亮或者不亮)(1<<20)最多可能的情况有1048576种 dp【i】表示 i 状态时灯所能照射到的最远距离(i 的二进制中如果第j位为0,则表示第j个灯不亮,否则就是亮) 当i&(1<< j)时代表第i个状态灯j不亮,此时可由状态i转移到状态 i ^ ( 1 << j) 即d 阅读全文
posted @ 2017-08-14 19:27 walfy 阅读(234) 评论(0) 推荐(0) 编辑
摘要: KMP,先预处理按每个节点标记,扫一遍更新每个匹配位置,最后kmp判断是否有重合而且不相同的地方 注意处理细节,很容易runtime error #include<map> #include<set> #include<cmath> #include<queue> #include<stack> # 阅读全文
posted @ 2017-08-14 15:36 walfy 阅读(169) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 56 下一页