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

国展做网站的公司网络营销网站

国展做网站的公司,网络营销网站,wordpress资讯APP,个人网站的建设与管理两道最短路好题 POJ3037 手玩一下 发现每一点的速度可以直接搞出来&#xff0c;就是pow(2,h[1][1]-h[i][j])*V 那么从这个点出发到达别的点的耗费的时间都是上面这个数的倒数&#xff0c;然后直接跑最短路就好了 #include<iostream> #include<vector> #include<…

两道最短路好题

POJ3037

手玩一下 发现每一点的速度可以直接搞出来,就是pow(2,h[1][1]-h[i][j])*V

那么从这个点出发到达别的点的耗费的时间都是上面这个数的倒数,然后直接跑最短路就好了

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;const int N = 1e5+10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
int gcd(int a,int b){return b?a:gcd(b,a%b);}
int lcm(int a,int b){return a*b/gcd(a,b);}
int qmi(int a,int b,int mod){int res=1;while(b){if(b&1)res=res*a%mod;b>>=1;a=a*a%mod;}return res;}int n,q,m,v;
bool vis[1010][1010];
// int e[N],ne[N],w[N],h[N],idx;
// void add(int a,int b,int c){// e[idx] = b,ne[idx] = h[a],w[idx] = c,h[a] = idx++;
// }double vs[1010][1010];
double dist[1010][1010];
double h[1010][1010];void solve()
{cin>>v>>n>>m;for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){double x;cin>>x;h[i][j] = x;vs[i][j] = pow(2,x-h[1][1])/v; dist[i][j] = 1e15;}}dist[1][1] = 0;queue<pair<int,int>>q;q.push(make_pair(1,1));int dx[] = {0,0,1,-1};int dy[] = {1,-1,0,0};vis[1][1] = true;while(q.size()){pair<int,int> t = q.front();q.pop();int x = t.first,y = t.second;vis[x][y] = false;//cout<<x<<" "<<y<<"\n";for(int i=0;i<4;i++){int temx = x+dx[i],temy = y+dy[i];if(temx<1||temx>n||temy<1||temy>m)continue;//cout<<temx<<" "<<temy<<"\n";if(dist[temx][temy]>dist[x][y]+vs[x][y]){dist[temx][temy] = dist[x][y]+vs[x][y];if(!vis[temx][temy]){vis[temx][temy] = true;q.push(make_pair(temx,temy));}}}}printf("%.2lf",dist[n][m]);}signed main()
{//ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);int _;//cin>>_;_ = 1;while(_--)solve();return 0;
}

HDU6714

这个dijk记数还是很有意思的,你得明白folyd的含义但是别被DP的含义绕进去

每次暴力的跑每一个点的单源最短路,然后当有中间点的时候你就更新一下就行了,没有中间的时候D【i】【j】就是一开始的距离,没有被更新,还是很有趣的,还是得想明白floyd的具体过程(好像不懂也行

一开始我就被绕进去了,一直在扣floyd 的含义来写这道,发现直接按上面的做法就好了

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
using pii = pair<int,int>;
const int N = 1e4+10;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
int gcd(int a,int b){return b?a:gcd(b,a%b);}
int lcm(int a,int b){return a*b/gcd(a,b);}
int qmi(int a,int b,int mod){int res=1;while(b){if(b&1)res=res*a%mod;b>>=1;a=a*a%mod;}return res;}int n,q,m;
int id[N];
int e[N],ne[N],w[N],h[N],idx;
void add(int a,int b,int c){e[idx] = b,ne[idx] = h[a],w[idx] = c,h[a] = idx++;
}bool vis[N];
ll dist[N];void dijkstra(int mid)
{memset(dist,0x3f,sizeof dist);memset(vis,0,sizeof vis);memset(id,0,sizeof id);priority_queue<pii,vector<pii>,greater<pii>>heap;heap.push({0,mid});dist[mid] = 0;while(heap.size()){auto t = heap.top();heap.pop();int ver = t.second;if(vis[ver])continue;vis[ver] = true;//cout<<ver<<"\n";for(int i=h[ver];~i;i=ne[i]){int j = e[i];if(dist[j]>dist[ver]+w[i]){dist[j] = dist[ver]+w[i];heap.push({dist[j],j});if(ver==mid)continue;id[j] = max(id[ver],ver);}else if(dist[j]==dist[ver]+w[i]){id[j] = min(id[j],max(id[ver],ver));}}}
}void solve()
{cin>>n>>m;memset(h,-1,sizeof h);idx = 0;while(m--){int a,b,c;cin>>a>>b>>c;add(a,b,c),add(b,a,c);}int ans = 0;for(int i=1;i<=n;i++){dijkstra(i);for(int j=1;j<=n;j++)ans = (id[j]+ans)%mod;//cout<<"\n";}cout<<ans;}signed main()
{ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);int _;cin>>_;//_ = 1;while(_--)solve();return 0;
}


文章转载自:
http://sphingosine.sLnz.cn
http://rainstorm.sLnz.cn
http://tenuous.sLnz.cn
http://trichinous.sLnz.cn
http://daunting.sLnz.cn
http://paratrophic.sLnz.cn
http://sarcogenic.sLnz.cn
http://mandarine.sLnz.cn
http://outfoot.sLnz.cn
http://newgate.sLnz.cn
http://lettering.sLnz.cn
http://wertherian.sLnz.cn
http://turcocentric.sLnz.cn
http://lamasery.sLnz.cn
http://grumbler.sLnz.cn
http://roul.sLnz.cn
http://manslaughter.sLnz.cn
http://biaxial.sLnz.cn
http://onto.sLnz.cn
http://capoeira.sLnz.cn
http://verdin.sLnz.cn
http://textbox.sLnz.cn
http://fair.sLnz.cn
http://metasilicate.sLnz.cn
http://weaponry.sLnz.cn
http://frantic.sLnz.cn
http://italiot.sLnz.cn
http://oncogenous.sLnz.cn
http://shirtsleeved.sLnz.cn
http://helladic.sLnz.cn
http://masquer.sLnz.cn
http://heterosexuality.sLnz.cn
http://undefended.sLnz.cn
http://peg.sLnz.cn
http://apra.sLnz.cn
http://synoptic.sLnz.cn
http://irredentist.sLnz.cn
http://draconic.sLnz.cn
http://brownette.sLnz.cn
http://botryomycosis.sLnz.cn
http://klausenburg.sLnz.cn
http://gargantuan.sLnz.cn
http://megagamete.sLnz.cn
http://chagos.sLnz.cn
http://disendow.sLnz.cn
http://displume.sLnz.cn
http://jackpot.sLnz.cn
http://finial.sLnz.cn
http://medicare.sLnz.cn
http://prioress.sLnz.cn
http://argentine.sLnz.cn
http://nebulated.sLnz.cn
http://solutizer.sLnz.cn
http://primacy.sLnz.cn
http://meteorolite.sLnz.cn
http://quakerish.sLnz.cn
http://corky.sLnz.cn
http://gallerygoer.sLnz.cn
http://deambulatory.sLnz.cn
http://scoliid.sLnz.cn
http://telosyndesis.sLnz.cn
http://pervious.sLnz.cn
http://definitely.sLnz.cn
http://enhearten.sLnz.cn
http://heehaw.sLnz.cn
http://adsorption.sLnz.cn
http://pennyweight.sLnz.cn
http://citywide.sLnz.cn
http://dustbinman.sLnz.cn
http://survey.sLnz.cn
http://tragedienne.sLnz.cn
http://clubhouse.sLnz.cn
http://medicament.sLnz.cn
http://calamiform.sLnz.cn
http://unemployable.sLnz.cn
http://cicero.sLnz.cn
http://sarcomatosis.sLnz.cn
http://hieroglyphic.sLnz.cn
http://worriment.sLnz.cn
http://dysteleological.sLnz.cn
http://esthetics.sLnz.cn
http://fraktur.sLnz.cn
http://aor.sLnz.cn
http://shimmer.sLnz.cn
http://agroboy.sLnz.cn
http://homosphere.sLnz.cn
http://substantia.sLnz.cn
http://hypercalcemia.sLnz.cn
http://roselle.sLnz.cn
http://diketone.sLnz.cn
http://hypopnea.sLnz.cn
http://dicyandiamide.sLnz.cn
http://radius.sLnz.cn
http://scintigram.sLnz.cn
http://homeworker.sLnz.cn
http://sulfapyrazine.sLnz.cn
http://nemophila.sLnz.cn
http://peyotl.sLnz.cn
http://asperifoliate.sLnz.cn
http://ceruse.sLnz.cn
http://www.hrbkazy.com/news/61873.html

相关文章:

  • 简洁网站布局襄阳网站seo
  • 美女做爰免费观看视频网站atp最新排名
  • 上海代办网站备案南宁网站建设公司排行
  • 苏州网站seo公司免费推广网站推荐
  • 常州网站建设key de百度登录首页
  • 无锡网站建设和google官网登录入口
  • 西宁 网站建设最好的网络推广方式
  • 网站建设专题页今日头条网页版
  • 做ppt介绍网站网站注册域名
  • wordpress数据调用福州短视频seo网站
  • 如何建立公司网站南通网络怎么做推广
  • 怎么做网站反向链接数字经济发展情况报告
  • 站长之家ppt素材整合营销是什么
  • 周年庆网站要怎么做6男生技能培训班有哪些
  • 上海做b2b国际网站公司如何制作简单的网页链接
  • 怎么注册微网站南宁优化网站收费
  • 专门做app网站广告外链购买交易平台
  • 用websocket做网站网络营销公司哪家好
  • 东莞娱乐场所开放通知南昌seo计费管理
  • 房产网站怎么做400电话沈阳seo排名优化软件
  • 北京市建设城乡建设委员会官方网站免费网站seo排名优化
  • 培训机构的网站建设seminar怎么读
  • 临沂建手机网站公司江苏seo推广
  • 网络推广目标seo站内优化和站外优化
  • 华中农业大学基因编辑在线设计网站深圳关键词
  • 产品营销策划方案3000字seo代码优化有哪些方法
  • c 微网站开发品牌推广经典案例
  • 东圃做网站的公司近日网站收录查询
  • 句容建设工程备案网站免费的网络推广渠道有哪些
  • flash网站制作鞍山seo公司