自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

mengbi_er的博客

就让我永远不在这里写什么有意义的话 ——by alone_wolf

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

原创 oi各种模板总结

先挖坑,以后不断填坑。图论tarjanbzoj1051 受欢迎的牛#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<stack>using namespace std;stack<int> s;int n,m,tot,head[10005],dfn[10005],low[10

2017-06-28 21:50:19 489

原创 Codeforces Round #421 (Div. 2) C. Mister B and Boring Game

题目大意按字母表顺序给出一个初始字符串s,长度为a,你可以任意添加b个字符,之后你的对手将加入a个不同的长度为a的后缀中未出现的字符(字典序加入),询问从l到r中最少出现几个不同字符。题解将前a个字符写出,我们可以发现,只有自己写出前面出现过的字符,对手写出的新字符个数才能尽可能少。而为了让区间中不同字符个数少,我们应写相同的字符,由于对手只写后a字符中未出现的字符,所以每次写的字符应是当前最后一个

2017-06-28 01:53:53 566

原创 Codeforces Round #421 (Div. 2) B. Mister B and Angle in Polygon

题目大意给出正多边形边数n,一个角度a,选出三个顶点,使所成角度最接近a。题解由等弧所对的圆周角相等知·,一个顶点向其它所有顶点连一条线段,相邻两线段间夹角相等(定义为单位角),所以o(n)枚举选择单位角个数,判断是否更接近(似乎能o(1)做)。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#inc

2017-06-28 01:42:00 248

原创 Codeforces Round #421 (Div. 2) A. Mister B and Book Reading

题目大意一本c页的书,第一天看v0页,以后每天前一天多看a页,但最多一天看v1页,每天向前回看l页,多少天能看完。题解想起了小学奥数题。。。 模拟即可。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int read(){ char ch=getch

2017-06-28 01:35:18 230

原创 bzoj3750: [POI2015]Pieczęć

暴力出奇迹。#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;bool k[1005][1005];int cx[1000005],cy[1000005],n,m,a,b;int main(){ int t; cin>>t; whi

2017-06-26 14:50:21 247

转载 bzoj4029: [HEOI2015]定价

尽量让末尾多0。判断能不能是5. 附黄学长代码(其实是我写挂不想改QAQ)。#include<set>#include<map>#include<ctime>#include<queue>#include<cmath>#include<cstdio>#include<vector>#include<cstring>#include<cstdlib>#include<iostrea

2017-06-26 14:47:57 357

原创 bzoj1968: [Ahoi2005]COMMON 约数研究

计算每个数对答案的贡献。#include<iostream>using namespace std;int main(){ int n; cin>>n; int ans=0; for(int i=1;i<=n;i++) { ans+=n/i; } cout<<ans;}

2017-06-26 14:42:58 211

转载 Codeforces Round #420 (Div. 2) E. Okabe and El Psy Kongroo

博主蒟蒻,并不会这道题。转一篇比较好的题解。 传送门

2017-06-26 14:32:14 290

原创 Codeforces Round #420 (Div. 2) D - Okabe and City

好像并不太懂啊,先挖坑。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int inf=0x7f7f7f7f;int read(){ char ch=getchar();int f=0; while(ch<'0'||ch>'9'

2017-06-26 14:28:12 306

原创 Codeforces Round #420 (Div. 2) C. Okabe and Boxes

题目大意两种操作: 1.向栈中加入x元素。 2.删除栈顶元素。 需要修改几次顺序能使序列单调递增。题解模拟栈。 add操作向栈中加入元素。 remove操作若栈顶元素等于remove次数,弹出栈顶。否则把栈清空,答案加1. (博主实在太弱啦,竟然想用单调栈和最长上升子序列)#include<iostream>#include<cstdio>#include<cstring>#inc

2017-06-26 13:14:15 295

原创 Codeforces Round #420 (Div. 2) B. Okabe and Banana Trees

题目大意给出一次函数y=-x/m+b,它与x轴y轴围成平面中,每个点(x,y)贡献(x+y),在这个平面中画一个矩形,所围成点的最大价值和是多少。题解分别计算纵坐标减1后在范围外的点和新增加的点。(要用long long,比赛时被max函数坑wa了2发)。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>

2017-06-26 13:04:01 428

原创 Codeforces Round #420 (Div. 2) A. Okabe and Future Gadget Laboratory

题目大意给出一个n*n矩阵,判断对于每个不等于1的数是否存在其所在行和所在列数相加等于这个数。example3 1 1 2 2 3 1 6 4 1 output:Yes 2=1+1, 2=1+1,3=2+1, 6=2+4.4=3+1.题解暴力枚举即可。#include<iostream>#include<cstdio>#include<cstring>#include<algor

2017-06-26 12:52:59 294

原创 BWT算法 && BZOJ2408:混乱的置换

BWT简介BWT算法可以将原文本转换成相似文本,并且可以用其他技术进行压缩。编码方式(1) 将文本串后加一个文本中不会出现的字符‘#’。(定义#小于文本串中任一字符) (2) 将文本串不断右移,得到新文本串。 (3) 将所有得到的文本串从小到大排序。 (4) 记F为排序后每个字符串第一个字符,L为每个字符串最后一个字符。易知原文本串中字符在F和L中分别出现且仅出现一次。 (5) L列即为处理

2017-06-18 17:06:17 1101

原创 bzoj1754: [Usaco2005 qua]Bull Math

高精度乘法模板。。。#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>using namespace std;int main(void){ string m,n; cin>>m>>n; int p,q; p=m.size();

2017-06-18 16:54:05 295

原创 bzoj3208: 花神的秒题计划Ⅰ

类似dp的记忆化搜索,看代码就似乎很好懂。。。 (其实是我太懒了233)#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int n,f[1005][1005],a[1005][1005],ans;bool k[1005][1005];int mx(int

2017-06-15 22:18:55 289

原创 bzoj1119: [POI2009]SLO

这题跟bzoj1697一样的啊,可以水双倍经验啦。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;long long b[1000005],ans,c[1000005],w[1000005];bool vis[1000005];struct data{

2017-06-15 22:12:41 278

原创 1697: [Usaco2007 Feb]Cow Sorting牛排序

这道题置换群裸题,对于一个置换群,交换所需代价为sum+min((tot-2)群里最小值,(tot+1)群里最小值+最小数);#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;long long b[1000005],ans,c[1000005],w[10000

2017-06-15 22:08:53 391

原创 bzoj1857: [Scoi2010]传送带

显然时间函数有单调性,自然会想到三分。(貌似大家都知道这是三分模板题。。。)#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;const double eps=1e-4;int ax,ay,bx,by,cx,cy,dx,dy,p

2017-06-13 21:45:39 336

原创 bzoj1441: Min

a1*x1+a2*x2+…+an*xn=s,s的最小值为gcd(a1,a2,…,an).#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;int main(){ int n; cin>>n; int an

2017-06-13 21:40:30 299

原创 bzoj3850: ZCC Loves Codefires

贪心,按Ei/Ki从小到大排序#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct ti{ double tim; double lose; double value;}a[1000005];int cmp(ti x,ti

2017-06-13 21:30:49 281

原创 bzoj2834: 回家的路

对于同一行和同一列的相邻的点分别建边。对行和列分层。建长度为1的边,之后SPFA即可。具体细节看代码。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<queue>using namespace std;queue<int> q;struct point{ int x;

2017-06-12 21:03:42 449 2

原创 bzoj3403: [Usaco2009 Open]Cow Line 直线上的牛

这也是一道模拟题。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int a[300003];int head=150000,tail=149999,now=0;int main(){ int n,x;char s,t; cin>>n;

2017-06-12 20:51:57 358

原创 bzoj1689: [Usaco2005 Open] Muddy roads 泥泞的路

把水坑按初始位置排序·,然后简单模拟,具体方式看代码。#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct water{ int from; int to;}a[100005];int cmp(water x,water y){

2017-06-12 20:50:24 377

原创 bzoj4846: [neerc2016]Hard Refactoring

这题是2017北大营的一道题,其实简单模拟即可,但是细节比较多,还是挺可做的#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int a[70005];bool sig=0;char ch;long long read(){ ch=getchar(

2017-06-12 13:46:16 453

原创 bzoj2295: 【POJ Challenge】我爱你啊

bzoj竟然有这么水的题,当然要把它秒掉。includeincludeincludeincludeusing namespace std; char c,t[]=”luvletter”; int main() { int n; cin>>n; while(c==getchar()) { if(c==’\n’) brea

2017-06-12 13:23:58 445

空空如也

空空如也

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

TA关注的人

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