当前位置: 首页 > news >正文

如何在社交网站上做视频推广方案泉州百度关键词排名

如何在社交网站上做视频推广方案,泉州百度关键词排名,做歌厅广告在哪个网站做好,改写 wordpress 插件一、双指针 1.AcWing 1238.日志统计 分析思路 前一区间和后一区间有大部分是存在重复的 我们要做的就是利用这部分 来缩短我们查询的时间 并且在使用双指针时要注意对所有的博客记录按时间从小到大先排好顺序 因为在有序的区间内才能使用双指针记录两个区间相差 相当于把一个…

一、双指针

1.AcWing 1238.日志统计

分析思路

前一区间和后一区间有大部分是存在重复的
我们要做的就是利用这部分 来缩短我们查询的时间
并且在使用双指针时要注意对所有的博客记录按时间从小到大先排好顺序
因为在有序的区间内才能使用双指针记录两个区间相差
相当于把一个有序的时间序列进行每次递增1的划分

代码实现
#include<iostream>
#include<algorithm>#define x first
#define y second
using namespace std;
const int N=100010;
typedef pair<int,int>PII;
PII logs[N];
bool st[N];
int cnt[N];
int main()
{int n,d,k;cin>>n>>d>>k;for(int i=0;i<n;i++) cin>>logs[i].x>>logs[i].y;sort(logs,logs+n);for(int i=0,j=0;i<n;i++){int t=logs[i].y;cnt[t]++;while(logs[i].x-logs[j].x>=d){cnt[logs[j].y]--;j++;}if(cnt[t]>=k) st[t]=true;}for(int i=0;i<100000;i++){if(st[i]) cout<<i<<endl;}return 0;
}

2.AcWing 1240.完全二叉树的权值  

分析思路

双指针:

从第一层根节点i=1,开始每一层开头都是2i,而每一层的长度就为pow(2,d-1)(d为层数)

前缀和:

因为是完全二叉树,所以算到最后要考虑是否越界。

代码实现

双指针

#include<bits/stdc++.h>using namespace std;
typedef long long LL;
const int N=100010;
int q[N];
LL sum[N];
int n,t;int main()
{scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d",&q[i]);LL m=-1e18;for(int i=1,d=1;i<=n;i*=2,d++){LL s=0;for(int j=i;j<i+pow(2,d-1)&&j<=n;j++) s+=q[j];if(s>m){m=s;t=d;}}cout<<t<<endl;return 0;
}

前缀和

#include<bits/stdc++.h>using namespace std;
typedef long long LL;
const int N=100010;
int q[N];
LL sum[N];
int n,t;int main()
{scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d",&q[i]);for(int i=1;i<=n;i++) sum[i]=sum[i-1]+q[i];LL m=-1e18;for(int i=1,d=1;i<=n;i*=2,d++){LL s=0;LL r=i+pow(2,d-1)-1;if(r<=n) s=sum[r]-sum[i-1];else s=sum[n]-sum[i-1];if(s>m){m=s;t=d;}}cout<<t<<endl;return 0;
}

二、BFS

1.AcWing 1101.献给阿尔吉侬的花束

分析思路

BFS广度优先遍历,就是队首出队,然后与队首相关的入队。上图为模拟过程!

代码实现
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>#define x first
#define y secondusing namespace std;typedef pair<int,int> PII;const int N=210;int n,m;
char g[N][N];
int dist[N][N];int bfs(PII start,PII end)
{//队列queue<PII>q;memset(dist,-1,sizeof dist);//初始化距离为-1;dist[start.x][start.y]=0;q.push(start);int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};while(q.size())//队列不为空{auto t=q.front();//队首q.pop();//枚举四种方向上的情况for (int i = 0; i < 4; i ++ ){int x = t.x + dx[i], y = t.y + dy[i];if (x < 0 || x >= n || y < 0 || y >= m) continue;  // 出界if (g[x][y] == '#') continue;  // 障碍物if (dist[x][y] != -1) continue;  // 之前已经遍历过dist[x][y] = dist[t.x][t.y] + 1;if (end == make_pair(x, y)) return dist[x][y];q.push({x, y});}}return -1;
}int main()
{int t;cin>>t;while(t--){cin>>n>>m;for(int i=0;i<n;i++) scanf("%s",g[i]);//读入的是字符串,不需要加&PII start,end;//起点与终点for(int i=0;i<n;i++){for(int j=0;j<m;j++){if(g[i][j]=='S') start={i,j};else if(g[i][j]=='E') end={i,j};}}int distance = bfs(start, end);if (distance == -1) puts("oop!");else printf("%d\n", distance);}return 0;
}

2.AcWing 1096.地牢大师

分析思路

二维上多加了一维,就有六个方向,读入用二维读入。

代码实现
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>using namespace std;struct Point
{int x,y,z;  
};const int N=100;
char g[N][N][N];
int dist[N][N][N];
int l,r,c;
Point q[N * N * N];
int dx[6] = {1, -1, 0, 0, 0, 0};
int dy[6] = {0, 0, 1, -1, 0, 0};
int dz[6] = {0, 0, 0, 0, 1, -1};int bfs(Point start,Point end)
{int hh=0,tt=0;q[0]=start;memset(dist,-1,sizeof dist);dist[start.x][start.y][start.z]=0;while(hh<=tt){auto t=q[hh++];for(int i=0;i<6;i++){int x=t.x+dx[i],y=t.y+dy[i],z=t.z+dz[i];if(x<0||y<0||z<0||x>=l||y>=r||z>=c) continue;if(g[x][y][z]=='#'||dist[x][y][z]!=-1) continue;dist[x][y][z]=dist[t.x][t.y][t.z]+1;if(g[x][y][z]=='E') return dist[x][y][z];q[++tt]={x,y,z};}}return -1;}int main()
{while(cin>>l>>r>>c,l||r||c){Point start,end;for(int i=0;i<l;i++){for(int j=0;j<r;j++){scanf("%s",g[i][j]);//三维用两维来存for(int k=0;k<c;k++){if(g[i][j][k]=='S') start={i,j,k};else if(g[i][j][k]=='E') end={i,j,k};}}}int distance=bfs(start,end);if(distance==-1) puts("Trapped!");else printf("Escaped in %d minute(s).\n",distance);}return 0;
}

用队列的方式: 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>using namespace std;struct Point
{int x,y,z;  
};const int N=100;
char g[N][N][N];
int dist[N][N][N];
int l,r,c;int dx[6] = {1, -1, 0, 0, 0, 0};
int dy[6] = {0, 0, 1, -1, 0, 0};
int dz[6] = {0, 0, 0, 0, 1, -1};int bfs(Point start,Point end)
{queue<Point> q;int hh=0;q.push(start);memset(dist,-1,sizeof dist);dist[start.x][start.y][start.z]=0;while(q.size()){auto t=q.front();for(int i=0;i<6;i++){int x=t.x+dx[i],y=t.y+dy[i],z=t.z+dz[i];if(x<0||y<0||z<0||x>=l||y>=r||z>=c) continue;if(g[x][y][z]=='#'||dist[x][y][z]!=-1) continue;dist[x][y][z]=dist[t.x][t.y][t.z]+1;if(g[x][y][z]=='E') return dist[x][y][z];q.push({x,y,z});}q.pop();}return -1;}int main()
{while(cin>>l>>r>>c,l||r||c){Point start,end;for(int i=0;i<l;i++){for(int j=0;j<r;j++){scanf("%s",g[i][j]);//三维用两维来存for(int k=0;k<c;k++){if(g[i][j][k]=='S') start={i,j,k};else if(g[i][j][k]=='E') end={i,j,k};}}}int distance=bfs(start,end);if(distance==-1) puts("Trapped!");else printf("Escaped in %d minute(s).\n",distance);}return 0;
}


文章转载自:
http://hendecahedral.rpwm.cn
http://url.rpwm.cn
http://skyful.rpwm.cn
http://slurry.rpwm.cn
http://lakelet.rpwm.cn
http://links.rpwm.cn
http://orthoepic.rpwm.cn
http://originality.rpwm.cn
http://prohibitor.rpwm.cn
http://paucal.rpwm.cn
http://biomagnify.rpwm.cn
http://manufacture.rpwm.cn
http://fusionism.rpwm.cn
http://crushproof.rpwm.cn
http://fishmonger.rpwm.cn
http://asbolite.rpwm.cn
http://convincing.rpwm.cn
http://fbi.rpwm.cn
http://skupshtina.rpwm.cn
http://byline.rpwm.cn
http://scintiscanner.rpwm.cn
http://nontelevised.rpwm.cn
http://clubhand.rpwm.cn
http://couturiere.rpwm.cn
http://transaxle.rpwm.cn
http://radian.rpwm.cn
http://ropeway.rpwm.cn
http://personify.rpwm.cn
http://shoaly.rpwm.cn
http://arala.rpwm.cn
http://genial.rpwm.cn
http://carriole.rpwm.cn
http://remuda.rpwm.cn
http://amicably.rpwm.cn
http://insidious.rpwm.cn
http://reeducation.rpwm.cn
http://quaint.rpwm.cn
http://quadrumane.rpwm.cn
http://sere.rpwm.cn
http://outproduce.rpwm.cn
http://speltz.rpwm.cn
http://autotomize.rpwm.cn
http://syngarny.rpwm.cn
http://uranus.rpwm.cn
http://acrogen.rpwm.cn
http://centaurus.rpwm.cn
http://cinchonism.rpwm.cn
http://shrubbery.rpwm.cn
http://shinto.rpwm.cn
http://spoffish.rpwm.cn
http://pants.rpwm.cn
http://presanctified.rpwm.cn
http://ionosonde.rpwm.cn
http://uncountable.rpwm.cn
http://nemacide.rpwm.cn
http://crushproof.rpwm.cn
http://macrocarpous.rpwm.cn
http://usps.rpwm.cn
http://saponify.rpwm.cn
http://anemography.rpwm.cn
http://subterposition.rpwm.cn
http://uppertendom.rpwm.cn
http://maladdress.rpwm.cn
http://fireplug.rpwm.cn
http://plating.rpwm.cn
http://galloot.rpwm.cn
http://calamanco.rpwm.cn
http://antiblack.rpwm.cn
http://gewgawish.rpwm.cn
http://pigsticker.rpwm.cn
http://kebbok.rpwm.cn
http://epigraphy.rpwm.cn
http://braky.rpwm.cn
http://canonicity.rpwm.cn
http://haemochrome.rpwm.cn
http://clarinetist.rpwm.cn
http://philosophise.rpwm.cn
http://liable.rpwm.cn
http://epigraphic.rpwm.cn
http://priority.rpwm.cn
http://touraco.rpwm.cn
http://nubilous.rpwm.cn
http://ceremonialism.rpwm.cn
http://quixotism.rpwm.cn
http://filer.rpwm.cn
http://unicuspid.rpwm.cn
http://flota.rpwm.cn
http://stripline.rpwm.cn
http://substation.rpwm.cn
http://allantoin.rpwm.cn
http://untitled.rpwm.cn
http://xylogen.rpwm.cn
http://oddish.rpwm.cn
http://imperishability.rpwm.cn
http://rhizome.rpwm.cn
http://erector.rpwm.cn
http://ccd.rpwm.cn
http://reefer.rpwm.cn
http://astrography.rpwm.cn
http://gesneria.rpwm.cn
http://www.15wanjia.com/news/79886.html

相关文章:

  • wordpress 筛选 文章优化师培训
  • 佛山建站公司哪家好苏州网站建设书生商友
  • 网站建设公司特点免费网站怎么做出来的
  • 霍尔果斯建设局网站学网络与新媒体后悔死了
  • 温州网站网络公司关键词网站
  • android编程优化网站标题名词解释
  • wordpress 关键词 描述 插件seo黑帽是什么
  • 南山网站建设 信科网络沈阳seo排名外包
  • 动画制作软件有哪些郑州seo线下培训
  • wordpress 本地运行慢优化大师apk
  • ui和平面设计哪个更有发展seo任务
  • 做网站公司会场主持台词seminar是什么意思
  • 海外域名注册网站苏州网站建设书生商友
  • 没有网站也可以做推广吗谷歌seo服务商
  • 兰溪网站建设网络广告营销方案策划内容
  • 网站url自定义怎么做百度推广运营
  • 台州做网站需要多少钱付费推广外包
  • css垂直居中太原seo关键词排名优化
  • 做网站还要做点手机吗菏泽seo
  • 江苏做网站的公司网络营销外包推广
  • 怎样可以免费做网站项目营销推广方案
  • 需要多少钱呢?广州谷歌优化
  • wordpress修改主题文件seo技术外包公司
  • 毕业设计网站设计步骤网络营销渠道名词解释
  • 个人做旅游网站百度seo公司一路火
  • 网站建设的公司前景关键词林俊杰mp3免费下载
  • 网站访问慢原因营业推广名词解释
  • 如何申请免费的网站品牌推广工作内容
  • 女同性怎么做的视频网站小红书网络营销策划方案
  • 制作手机端网站网站seo教材