自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

EM LGH

It's Time to Make History

  • 博客(110)
  • 收藏
  • 关注

原创 2018.9.30 ~ 2018.11.1 做题记录

2018.10.1

2018-09-30 22:07:25 212

原创 2018.9.30 ~ 2018.11.1 做题记录

2018.10.1上午:参加模拟赛:T1:60pts乱搞T2. AC Lost Cows POJ - 2182 树状数组 + 二分T3:MLE 0分下午:AC P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows 状压动归 注意空间AC B. Planning The Expedition...

2018-09-30 22:07:00 164

原创 CF div2 499 A. Stages

Code:#include<cstdio>#include<algorithm>#include<iostream>using namespace std;inline int get(char x){ return x - 'a' + 1;}int main(){ int n,k, arr[100], cnt = 0, pre = -1,...

2018-09-30 21:13:03 117

原创 CF div2 499 A. Stages

Code:#include<cstdio>#include<algorithm>#include<iostream>using namespace std;inline int get(char x){ return x - 'a' + 1;}int main(){ int n,k,...

2018-09-30 21:13:00 103

原创 随机数据生成

 Code:#include<cstdio>#include<algorithm>#include<ctime>#include<cstdlib>using namespace std;const int maxn = 2000;int arr[maxn];int random(int n){ return (long...

2018-09-29 12:52:00 89

原创 随机数据生成

Code:#include<cstdio>#include<algorithm>#include<ctime>#include<cstdlib>using namespace std;const int maxn = 2000;int arr[maxn];int random(int n){ return (long long) ra...

2018-09-29 12:51:52 370

原创 洛谷P2296 寻找道路_简单BFS

Code:#include<cstdio>#include<queue>#include<algorithm>using namespace std;const int maxn = 200000 + 3;int head[maxn<<1], to[maxn<<1], ...

2018-09-26 19:52:00 101

原创 洛谷P2296 寻找道路_简单BFS

Code:#include<cstdio>#include<queue>#include<algorithm>using namespace std;const int maxn = 200000 + 3;int head[maxn<<1], to[maxn<<1], nex[maxn<<1], cnt;int ...

2018-09-26 19:51:56 140

原创 洛谷P3807 【模板】卢卡斯定理_组合数学模板

 Code:#include<cstdio>using namespace std;typedef long long LL;const int maxn=1000000+2;LL mod;int MAXN;struct comb{ LL fac[maxn]; LL quick_pow(LL base,LL k) { LL ans=1; wh...

2018-09-26 12:34:00 85

原创 洛谷P3807 【模板】卢卡斯定理_组合数学模板

Code:#include<cstdio>using namespace std;typedef long long LL;const int maxn=1000000+2;LL mod;int MAXN;struct comb{ LL fac[maxn]; LL quick_pow(LL base,LL k) { LL ans=1; while(k) ...

2018-09-26 12:33:59 141

原创 Co-prime HDU - 4135_容斥计数

Code:#include<cstdio>#include<cstring>#include<cmath>#include<iostream>using namespace std;const int maxn=100000+233;typedef long long ll;int v[maxn],vis[maxn];int m[m...

2018-09-26 12:31:09 81

原创 Co-prime HDU - 4135_容斥计数

Code:#include<cstdio>#include<cstring>#include<cmath>#include<iostream>using namespace std;const int maxn=100000+233;typedef long long ll;i...

2018-09-26 12:31:00 61

原创 How many integers can you find HDU - 1796_容斥计数

Code:#include<cstdio>using namespace std;typedef long long ll;const int R=13;ll a[R];ll n,ans;int m,cnt=0;ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}void dfs(int cur,ll lcm,int id){ ...

2018-09-26 12:29:25 64

原创 How many integers can you find HDU - 1796_容斥计数

Code:#include<cstdio>using namespace std;typedef long long ll;const int R=13;ll a[R];ll n,ans;int m,cnt=0;ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}void d...

2018-09-26 12:29:00 65

原创 洛谷P1466 集合 Subset Sums_01背包水题

不多解释,适当刷刷水…Code:#include<cstdio>#include<algorithm>using namespace std;const int maxn = 10000000 + 3;long long f[maxn];int main(){ int n, sumv = 0;...

2018-09-25 20:58:00 69

原创 洛谷P1466 集合 Subset Sums_01背包水题

不多解释,适当刷刷水…Code:#include<cstdio>#include<algorithm>using namespace std;const int maxn = 10000000 + 3;long long f[maxn];int main(){ int n, sumv = 0; scanf("%d",&n); ...

2018-09-25 20:57:31 171

原创 [SCOI2008]奖励关_状压动归_数学期望

 Code:#include<cstdio>#include<algorithm>using namespace std;const int maxn = 20;double f[102][1 << maxn];int score[maxn], state[maxn], pos[maxn],n, m, tmp ;int main()...

2018-09-25 20:42:00 84

原创 [SCOI2008]奖励关 + 状压动归 + 数学期望

Code:#include<cstdio>#include<algorithm>using namespace std;const int maxn = 20;double f[102][1 << maxn];int score[maxn], state[maxn], pos[maxn],n, m, tmp ;int...

2018-09-25 20:42:00 74

原创 [SCOI2008]奖励关_状压动归_数学期望

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;const int maxn = 20;double f[102][1 &lt;&lt; maxn];int score[maxn], state[maxn], pos[maxn],n, m, tmp ;int main(){ for...

2018-09-25 20:41:45 126

原创 Aeroplane chess HDU - 4405_数学期望_逆推

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int maxn = 100000 + 233;const double perc = (1 / 6.0);double f[maxn];int vis[maxn];int mai...

2018-09-25 18:55:10 119

原创 Aeroplane chess HDU - 4405_数学期望_逆推

 Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int maxn = 100000 + 233;const double perc = (1 / 6.0);double f[maxn];int vis[maxn]...

2018-09-25 18:55:00 107

原创 洛谷P1850 换教室_数学期望_Floyd

调了一下午QAQ…让我对数学期望的理解又提升了一个层次。首先,我们发现 v&amp;amp;lt;=300v&amp;amp;lt;=300v&amp;lt;=300 , 这样我们就可以用 FloydFloydFloyd 算法来 O(n3)O(n^3)O(n3) 处理出任意两点间的最短路。对于题目,我们不难列出状态dp[i][j][0/1]dp[i][j][0/1]dp[i][j][0/1]。这个状态代表:走到第i...

2018-09-24 16:50:00 125

原创 洛谷P1850 换教室_数学期望_Floyd

调了一下午QAQ…让我对数学期望的理解又提升了一个层次。首先,我们发现 v&lt;=300 , 这样我们就可以用 Floyd 算法来 O(n3) 处理出任意两点间的最短路。对于题目,我们不难列出状态dp[i][j][0/1]。这个状态代表:走到第i个点,用了j次机会,当前使用了(0表示未使用,1表示使用)机会的最小期望值。首先,我们...

2018-09-24 16:50:00 77

原创 洛谷P2894 [USACO08FEB]酒店Hotel_区间更新_区间查询

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int N = 200000+5;int n,m,k;struct Segment_Tree{ int lazy,left,right,maxv;}Seg[N&l...

2018-09-24 14:51:00 103

原创 洛谷P2894 [USACO08FEB]酒店Hotel_区间更新_区间查询

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int N = 200000+5;int n,m,k;struct Segment_Tree{ int lazy,left,right,maxv;}Seg[N&lt;&lt;...

2018-09-24 14:50:57 164

原创 洛谷P1297 [国家集训队]单选错位_数学期望

考虑第 iii 位, 那么当前共有 a[i]a[i]a[i] 种选项,那么当前选项正确的情况就是下一个被误填的答案与当前答案相同。换句话说,当前答案一共有 a[i]a[i]a[i] 种可能,而下一个答案有 a[i+1]a[i + 1]a[i+1]种可能,那么总共有 a[i]∗a[i+1]a[i]*a[i+1]a[i]∗a[i+1] 种可能,其中,我们要去 min(a[i],a[i+1])min(a...

2018-09-24 11:06:19 96

原创 洛谷P1297 [国家集训队]单选错位_数学期望

考虑第 i 位, 那么当前共有 a[i] 种选项,那么当前选项正确的情况就是下一个被误填的答案与当前答案相同。换句话说,当前答案一共有 a[i] 种可能,而下一个答案有 a[i+1]种可能,那么总共有 a[i]∗a[i+1] 种可能,其中,我们要去 min(a[i],a[i+1]) 作为分子(想一想,为什么)。故每种答案的贡献为 1/max...

2018-09-24 11:06:00 149

原创 洛谷P1654 OSU!_概率与期望

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;const int maxn = 1000000 + 4;double f[maxn], g[maxn], h[maxn];int main(){ int n; scanf("%d",&amp;n); for(int ...

2018-09-24 10:44:11 218

原创 洛谷P1654 OSU!_概率与期望

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;const int maxn = 1000000 + 4;double f[maxn], g[maxn], h[maxn];int main(){ int n; sca...

2018-09-24 10:44:00 144

原创 USACO 2008 Nov Gold 3.Light Switching 线段树

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int maxn = 200000 + 4;int lazy[maxn &lt;&lt; 2], sumv[maxn &lt;&...

2018-09-24 10:43:00 106

原创 USACO 2008 Nov Gold 3.Light Switching 线段树

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;const int maxn = 200000 + 4;int lazy[maxn &lt;&lt; 2], sumv[maxn &lt;&lt; 2];inline void pushdown(...

2018-09-24 10:42:39 108

原创 USACO 2008 Mar Silver 3.River Crossing 动态规划水题

Code:#include&lt;cstring&gt;#include&lt;algorithm&gt;#include&lt;cstdio&gt;using namespace std;const int maxn = 2500 + 4;const int inf = 100000000;int f[maxn], sumv[maxn];int main(){ freo...

2018-09-24 10:39:02 101

原创 USACO 2008 Mar Silver 3.River Crossing 动态规划水题

Code:#include&lt;cstring&gt;#include&lt;algorithm&gt;#include&lt;cstdio&gt;using namespace std;const int maxn = 2500 + 4;const int inf = 100000000;int f[maxn], sumv...

2018-09-24 10:39:00 107

原创 常见经验总结

数据结构:一定考虑边界情况删除时清空节点信息如果空间不够,进行内存回收数组开2倍左右动态规划:5. 状态的设定6. 边界的初始化考试:7. fclose,freopen8. 不要用关键词9. 先大体看一遍题10. 注意小数精度问题11. 空间限制:千万不要MLE !12. CF 比赛时用 %I64d13. ...

2018-09-22 18:11:00 66

原创 Ikki's Story IV - Panda's Trick POJ - 3207_dfs跑2-SAT

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;vector&gt;using namespace std;const int maxn=3000;int c=0;int mark[maxn],S[maxn],from[maxn],to[maxn]...

2018-09-22 17:55:00 92

原创 Ikki's Story IV - Panda's Trick POJ - 3207_dfs跑2-SAT

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;vector&gt;using namespace std;const int maxn=3000;int c=0;int mark[maxn],S[maxn],from[maxn],to[maxn];vector&lt;int&gt;G[maxn];v...

2018-09-22 17:54:48 219

原创 洛谷P1993 小K的农场_差分约束_dfs跑SPFA

Code:#include&lt;cstdio&gt;#include&lt;queue&gt;using namespace std;const int N=10000+233;const int INF=10000000;int head[N],to[N&lt;&lt;1],nex[N&lt;&lt;1],val[N&lt;&lt;1],vis[N],d[N];int cnt;...

2018-09-22 17:53:04 118

原创 洛谷P1993 小K的农场_差分约束_dfs跑SPFA

Code:#include&lt;cstdio&gt;#include&lt;queue&gt;using namespace std;const int N=10000+233;const int INF=10000000;int head[N],to[N&lt;&lt;1],nex[N&lt;&lt;1],val[N&lt;...

2018-09-22 17:53:00 95

原创 洛谷P3275 [SCOI2011]糖果_差分约束_判负环

Code:#include&lt;cstdio&gt;#include&lt;queue&gt;#include&lt;algorithm&gt;using namespace std;const int N=300000+3;const int INF=-2333233;queue&lt;int&gt;Q;int d[N],inq[N],times[N];int head[N]...

2018-09-22 17:51:28 122

原创 洛谷P3275 [SCOI2011]糖果_差分约束_判负环

 Code:#include&lt;cstdio&gt;#include&lt;queue&gt;#include&lt;algorithm&gt;using namespace std;const int N=300000+3;const int INF=-2333233;queue&lt;int&gt;Q;int d[N],inq[N],times[N];in...

2018-09-22 17:51:00 54

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除