自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 Snowflake Snow Snowflakes POJ - 3349 && ACWING 137. 雪花雪花雪花

用Hash去处理每一片雪花的六个角,把六个角的积和总和的和去模P储存起来。先比较Hash值来比较六个角的值是否相等,再找两片雪花的角是否按顺时针或逆时针顺序相等。 #include<cstdio> #include<iostream> #include<cstring> #include<iomanip> using namespace std; c...

2019-12-23 19:27:28 215

原创 Sliding Window POJ - 2823

用单调队列来储存输入数的序号和值,遇到 #include<iostream> #include<cstdio> using namespace std; const int N=1000010; const int INF=0x3f3f3f3f; int maxa[N],maxt[N],maxl=0,maxr=1,ansmax[N]; int mina[N],mint[N]...

2019-12-16 17:57:17 144

原创 acwing 150 括号画家

用栈储存左右括号的序号,若左右括号匹配,则出栈。每处理一个字符就更新一次答案。 #include<iostream> #include<cstdio> #include<cstring> #include<stack> #include<algorithm> using namespace std; int main(){ string...

2019-12-07 16:20:49 213

原创 acwing 128 编辑器

#include<iostream> #include<cstdio> #include<cstring> #include<stack> using namespace std; stack<int> a,b; int sum[100010],f[100010]; int main(){ int n,t; char c; sca...

2019-12-07 16:03:32 191

原创 Largest Rectangle in a Histogram POJ - 2559 && Largest Submatrix of All 1’s POJ - 3494——单调栈

Largest Rectangle in a Histogram POJ - 2559 用单调栈求解。保存n个矩形的高,保持单调增,如果下一个矩形比栈顶的矩形矮,出栈并累计弹出的矩形的宽之和,中途计算弹出栈顶乘累计宽的最大值,直到栈顶小于下一个矩形,然后入栈并保存 累计宽+1 在当前位。最后加入一个高为0的矩形清空栈。 #include<iostream> #include<cs...

2019-12-04 17:44:31 138

原创 Bad Hair Day POJ - 3250

用stack来做单调栈,如果比栈顶小则入栈,比栈顶大就一直出栈直到比栈顶小,每次出栈ans加栈的大小,最后再出栈算ans加栈的大小 #include<iostream> #include<cstdio> #include<stack> using namespace std; int n; int main(){ scanf("%d",&n); st...

2019-12-02 18:00:37 154

原创 简单计算器 HDU - 1237

简单计算器 HDU - 1237 用栈模拟,优先乘除,减法改成加相反数。 #include<iostream> #include<cstdio> #include<stack> using namespace std; int main(){ char c; int n; stack<double> s; while(~scanf("%d",...

2019-11-27 17:44:10 181

原创 机器翻译 51Nod - 2640 || [NOIP2010]机器翻译 计蒜客 - T2097

在队列的基础上加个sum储存总数,开bool数组保存是否存在 #include<cstdio> #include<iostream> #include<queue> using namespace std; int n,m,sum; queue<int> q; bool a[1010]; int main(){ scanf("%d%d",&...

2019-11-27 17:28:18 525

原创 ACboy needs your help again! HDU - 1702

ACboy needs your help again! HDU - 1702 stl #include<cstdio> #include<iostream> #include<queue> #include<stack> using namespace std; int n,m; string s; int main(){ scanf("%d",...

2019-11-27 17:24:23 156

原创 Blah数集 OpenJ_Bailian - 3728

Blah数集 OpenJ_Bailian - 3728 用两个队列分别储存2a+1和3a+1,保证两个队列递增,拿对头比大小,扩展小的数,再把2a+1与3a+1加入队列,直至第n个数 #include<cstdio> #include<iostream> #include<queue> using namespace std; int main(){ int ...

2019-11-27 17:21:18 219

原创 hdu-4841圆桌问题

hdu-4841圆桌问题 用vector模拟n次后数组中剩下的是好人,然后判断0~2n-1是否在数组中,在输出G,不在输出B。 #include<iostream> #include<cstdio> #include<vector> using namespace std; int main(){ vector<int> table; int n...

2019-11-25 16:43:40 165

原创 hdu-1062 Text Reverse

hdu-1062 Text Reverse 直接用栈储存遇空格和换行把栈内数据输出清栈 #include<iostream> #include<cstdio> #include<stack> using namespace std; int main(){ int n; char c; scanf("%d",&n); c=getchar(); ...

2019-11-25 16:28:21 127

原创 POJ - 1012 Joseph

poj 1012JosephThe Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mth is going t...

2019-11-24 09:57:13 270

空空如也

空空如也

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

TA关注的人

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