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

怎样看网站建设wordpress 内容模板

怎样看网站建设,wordpress 内容模板,手机主页网站,建行网站会员是什么在以往的408学习中,我们 往往采用邻接表和邻接矩阵解决图的存储问题, 但是经过刷题过程发现也有一种新的存储形式值得我们学习,废话不多说,直接上代码 讲解 初始的数组 int e[N], w[N], ne[N], h[H], idx; 算法过程 void add…

在以往的408学习中,我们 往往采用邻接表和邻接矩阵解决图的存储问题,

但是经过刷题过程发现也有一种新的存储形式值得我们学习,废话不多说,直接上代码

讲解

初始的数组

int e[N], w[N], ne[N], h[H], idx;

算法过程


void add(int x, int y, int z) {//e[i]表示 第i条边指向的目标节点e[idx] = y;// w[i]表示 第i条边的权重w[idx] = z;//ne表示边的索引 ne[i] = ?表示 第i条边的下一条边是哪条边ne[idx] = h[x];//h[H]:每个节点的第一条边,h[1] = 3从点1 出发的第一条边是 3号边。h[x] = idx++;
}

 

 

看点例题

Welcome - Luogu Spilopelia

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
const int N=2e5+10;
int h[N],e[N],ne[N],w[N],idx;
int d[N];
bool vis[N];
bool t[103][103];//t[i][j]=true代表从i到j的道路损坏 
typedef pair<int,int> PII;
struct node{int u,v,w;
}p[N];
void add(int x,int y,int z)
{e[idx]=y;w[idx]=z;ne[idx]=h[x];h[x]=idx++;
}
void dijkstra(int x)
{memset(d,0x3f,sizeof d);d[x]=0;priority_queue<PII,vector<PII>,greater<PII> >q;q.push({d[x],x});while(!q.empty()){int now=q.top().second;q.pop();if(vis[now]) continue;vis[now]=true;for(int i=h[now];i!=-1;i=ne[i]){int j=e[i];if(d[j]>d[now]+w[i]){d[j]=d[now]+w[i];q.push({d[j],j});}}}
}
int main()
{int n,m;cin>>n>>m;for(int i=1;i<=n;i++)h[i]=-1;for(int i=1;i<=m;i++)scanf("%d%d%d",&p[i].u,&p[i].v,&p[i].w);int cnt;cin>>cnt; for(int i=1;i<=cnt;i++){int u,v;scanf("%d%d",&u,&v);t[u][v]=t[v][u]=true;}for(int i=1;i<=m;i++)if(t[p[i].u][p[i].v]){add(p[i].u,p[i].v,p[i].w);add(p[i].v,p[i].u,p[i].w);}else{add(p[i].u,p[i].v,0);add(p[i].v,p[i].u,0);}int b,e;cin>>b>>e;dijkstra(b);printf("%d\n",d[e]);return 0;
}

 

看点例题

https://www.acwing.com/solution/content/49931/

这个代码我写错了,但是思路感觉没啥问题

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;using LL = long long;
const int N = 110, M = 510, P = 100000;
int n, m;
int h[N], e[2*M], w[2*M], ne[2*M], idx;
int dist[N], p[N];
bool vis[N];int qmi(int a, int b, int p){int res = 1;while(b){if(b & 1) res = (LL)res * a % p;b >>= 1;a = (LL)a * a % p;}return res % p;
}int find(int x){if(x != p[x]) p[x] = find(p[x]);return p[x];
}void add(int a, int b, int c){e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx++;
}void dijkstra(){memset(dist, 0x3f, sizeof(dist));dist[0] = 0;for(int i = 1; i <= n; ++i){int t = -1;for(int j = 0; j < n; ++j){if(!vis[j] && (t == -1 || dist[t] > dist[j])){t = j;}}vis[t] = true;for(int i = h[t]; i != -1; i = ne[i]){int j = e[i];if(dist[j] > dist[t] + w[i]){dist[j] = dist[t] + w[i];}}}
}int main()
{cin >> n >> m;memset(h, -1, sizeof(h));for(int i = 0; i < n; ++i) p[i] = i;for(int i = 0; i < m; ++i){int a, b, c;cin >> a >> b;int aa = find(a), bb = find(b);if(aa != bb){p[aa] = bb;c = qmi(2, i, P);add(a, b, c);add(b, a, c);}else continue;}dijkstra();for(int i = 1; i < n; ++i){if(dist[i] == 0x3f3f3f3f) cout << "-1" << endl;else cout << dist[i] % P << endl;}return 0;
}// 作者:Asiim0v
// 链接:https://www.acwing.com/solution/content/49931/
// 来源:AcWing
// 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 


文章转载自:

http://3Jb5sQ67.txtgy.cn
http://3cgmdwrD.txtgy.cn
http://wRuqklEA.txtgy.cn
http://ZsLUYrJH.txtgy.cn
http://RY7nqGAR.txtgy.cn
http://yDffMQKE.txtgy.cn
http://fff3CjVT.txtgy.cn
http://mV2HfNpB.txtgy.cn
http://qKs2Y1uO.txtgy.cn
http://2ojIessR.txtgy.cn
http://G4MIN1Ju.txtgy.cn
http://GTKOPph7.txtgy.cn
http://w4MZFn7B.txtgy.cn
http://xsDtHMoa.txtgy.cn
http://c8gfLQ1d.txtgy.cn
http://ikHehbTk.txtgy.cn
http://QiXU3VQg.txtgy.cn
http://lnPOICcB.txtgy.cn
http://6dJjTSIM.txtgy.cn
http://cVPU57HN.txtgy.cn
http://CLC9EtXS.txtgy.cn
http://yO63vMQ8.txtgy.cn
http://Sy52SH7t.txtgy.cn
http://YUJ14YD0.txtgy.cn
http://5dPjjFCr.txtgy.cn
http://G1jTBPi3.txtgy.cn
http://Sg7iUPCS.txtgy.cn
http://H3BZ0VSp.txtgy.cn
http://vYg0aXa0.txtgy.cn
http://lZHjxCq6.txtgy.cn
http://www.dtcms.com/wzjs/700968.html

相关文章:

  • 做的好的学校网站网页表格代码
  • 外贸资讯网站云南省建设工作网站
  • 视频网站的防盗链是怎么做的摄影网页模板
  • 如何收集网站建设资料福州思企互联网站建设公司
  • 网络推广方案的制定流程百度自然搜索排名优化
  • dedecms后台程序已经安装完了怎么把自己的网站加进去?开源的企业网站管理系统
  • 禁止wordpress网站上传图片时自动生成三张图片方法沧州公司官网
  • 重庆网站备案快app开发网站建设
  • 成都网站创建网站制作建
  • 江门城乡建设部网站首页开发一个简单的小程序需要多少钱
  • 养老网站建设的意义网页微信版官网登录下载
  • 怎么做游戏自动充值的网站企业网址怎么申请
  • 大什么的网站建设公司好如何制作手机网站
  • 克拉玛依住房和建设局网站在线制作网页网站
  • 书店网站开发目的和意义当下最流行的营销方式
  • 广州海珠区赤岗 新港网站建设公司seo关键词排名优化要多少钱
  • 手机必备网站网站策划制作公司
  • 个人网站做联盟营销WordPress打开加载太慢
  • 营销软件网站公司建设网站的分录
  • 把自己的网站卖给别人后对方做违法wordpress 菜单字体大小
  • 海南省海口市建设厅网站aws wordpress ssl
  • 网站建设 有必要吗武义做网站
  • 中国建设银行网站属于什么机构官网设计优秀案例
  • 网站开发成本有哪些免费设计企业logo
  • php网站开发源代码广州自助公司建网站
  • 做网站3个月西安小程序搭建
  • 网站域名是什么意思怎么在凡科上做网站
  • 静宁县建设局网站什么网站做班服比较好
  • 哪个网站做图文素材多任丘网站建设
  • 渭南网站建设网站建设有做的小说网站