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

公司网站流程代运营公司是怎么运营的

公司网站流程,代运营公司是怎么运营的,广州网站建设制作公司,律师事务所网站建设方案原题链接: PTA | 程序设计类实验辅助教学平台 题面: 在一个名叫刀塔的国家里,有一只猛犸正在到处跑着,希望能够用它的长角抛物技能来撞飞别人。已知刀塔国有 N 座城市,城市之间由 M 条道路互相连接,为了拦…

原题链接:

PTA | 程序设计类实验辅助教学平台

题面:

在一个名叫刀塔的国家里,有一只猛犸正在到处跑着,希望能够用它的长角抛物技能来撞飞别人。已知刀塔国有 N 座城市,城市之间由 M 条道路互相连接,为了拦住这头猛犸,每条道路上设置了 Vi​ 人的团队。

这只猛犸从 S 号城市出发,它可以选择:

  1. 在不重复地经过若干条道路后回到 S 号城市;
  2. 在不重复地经过若干条道路后到达 T 号城市。

猛犸经过一条道路后,就会把路上的人全部撞飞。作为一头爱喝雪碧的仁慈的猛犸,自然希望尽可能的少撞飞人。请你帮忙计算一下在最优的选择下,最少需要撞飞多少人才能够到达目标城市?

输入格式:

输入第一行是四个正整数 N,M,S,T (2≤N≤500,1≤M≤105),表示有 N 个城市,M 条道路,猛犸从 S 号城市出发,可以选择到达 T 号城市。

接下来的 M 行,每行三个正整数 Xi​,Yi​,Vi​ (0≤Vi​≤100),表示从 Xi​ 号城市到 Yi​ 号城市有一条道路,道路上有 Vi​ 人的团队。道路可双向通行,城市编号从 1 开始,两个城市之间最多只有一条道路,且没有一条道路连接相同的城市。

数据保证两种选择里至少有一种是可行的。

输出格式:

输出两行,第一行是两个数字,分别对应上面的两种选择分别最少需要撞飞多少人。如果无论撞飞多少人都无法满足选择要求,则输出 -1

第二行是一个句子,如果第一种(回到原点)的选择比较好,就输出 Win!,否则输出Lose!

输入样例:

5 6 1 5
1 2 1
2 3 2
3 4 3
4 1 5
3 5 4
4 5 1

输出样例:

在这里给出相应的输出。例如:

11 6
Lose!

解题思路:

第二种方式直接跑dijkstra,计算出d[],d[t]即为答案。对于第一种方式,不难想到,最终得到的结果其实就是从s到某个点i的最短路,这个点i必须是与起点s直接存在一条相连的边,然后再从i直接到s,即d[i] + G[s][i] (1 <= i <= n)。但需要注意的是,我们在枚举i时应该重跑dijkstra,并且将s->i这条边暂时删除,不然得出的结果就是s->i->s。

代码(CPP):

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 1e3 + 10;
const int INF = 0x3fffffff;
const int mod = 1000000007;
struct edge {int v, w;bool operator < (const edge &other) const {return w > other.w;}
};
int G[maxn][maxn];
int d[maxn];
bool vis[maxn];
int n, m, s, t;void dijkstra() {memset(vis, 0, sizeof vis);fill(d, d + maxn, INF);d[s] = 0;priority_queue<edge> q;q.push({s, 0});while (!q.empty()) {int u = q.top().v;q.pop();if (vis[u]) {continue;}vis[u] = true;for (int v = 1; v <= n; v++) {if (G[u][v] != INF && !vis[v] && d[u] + G[u][v] < d[v]) {d[v] = d[u] + G[u][v];q.push({v, d[v]});}}}
}void solve() {cin >> n >> m >> s >> t;fill(G[0], G[0] + maxn * maxn, INF);while (m--) {int u, v, w;cin >> u >> v >> w;G[u][v] = G[v][u] = w;}// 第二种方式dijkstra();int ans2 = d[t];// 第一种方式int ans1 = INF;for (int i = 1; i <= n; i++) {if (s == i || G[i][s] == INF)continue;G[s][i] = INF;  // 要把直接从s到i的边删除,再计算dijkstradijkstra();ans1 = min(ans1, d[i] + G[i][s]);G[s][i] = G[i][s];}cout << (ans1 == INF ? -1 : ans1) << " " << (ans2 == INF ? -1 : ans2) << endl;if (ans1 < ans2)cout << "Win!";elsecout << "Lose!";
}int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout << fixed;cout.precision(18);solve();return 0;
}


文章转载自:
http://dinncochlamydospore.bkqw.cn
http://dinncopeg.bkqw.cn
http://dinncoshowgirl.bkqw.cn
http://dinncobaleen.bkqw.cn
http://dinncogametophore.bkqw.cn
http://dinncoabc.bkqw.cn
http://dinncotruckage.bkqw.cn
http://dinncochloroacetic.bkqw.cn
http://dinncosinsyne.bkqw.cn
http://dinncoprovenience.bkqw.cn
http://dinncoreran.bkqw.cn
http://dinncocornetist.bkqw.cn
http://dinncoskyey.bkqw.cn
http://dinncotapis.bkqw.cn
http://dinncohargeisa.bkqw.cn
http://dinncomixture.bkqw.cn
http://dinncodialogism.bkqw.cn
http://dinncopeanut.bkqw.cn
http://dinncocustomhouse.bkqw.cn
http://dinncomomenta.bkqw.cn
http://dinncobhakta.bkqw.cn
http://dinncounconducive.bkqw.cn
http://dinncodft.bkqw.cn
http://dinncoinfrasonic.bkqw.cn
http://dinncoreducer.bkqw.cn
http://dinncointentional.bkqw.cn
http://dinncopleurotomy.bkqw.cn
http://dinncotriggerfish.bkqw.cn
http://dinncobankable.bkqw.cn
http://dinncocete.bkqw.cn
http://dinncovertebratus.bkqw.cn
http://dinncolingulate.bkqw.cn
http://dinncodecrial.bkqw.cn
http://dinncopelew.bkqw.cn
http://dinncochalicothere.bkqw.cn
http://dinncoreflorescent.bkqw.cn
http://dinncoglaswegian.bkqw.cn
http://dinncofemoral.bkqw.cn
http://dinncoshadchan.bkqw.cn
http://dinncounsight.bkqw.cn
http://dinncoindebted.bkqw.cn
http://dinncoebullioscopic.bkqw.cn
http://dinncotiled.bkqw.cn
http://dinncoatmospherical.bkqw.cn
http://dinncomultitudinism.bkqw.cn
http://dinncocarnivorous.bkqw.cn
http://dinncoaristotle.bkqw.cn
http://dinncomaxwell.bkqw.cn
http://dinncocoenobitism.bkqw.cn
http://dinncoobstructive.bkqw.cn
http://dinncounreel.bkqw.cn
http://dinncotangiers.bkqw.cn
http://dinncophloem.bkqw.cn
http://dinncoratiocinate.bkqw.cn
http://dinncoshelf.bkqw.cn
http://dinncoouttop.bkqw.cn
http://dinncolongshoreman.bkqw.cn
http://dinncoitinerate.bkqw.cn
http://dinncosetem.bkqw.cn
http://dinncobraaivleis.bkqw.cn
http://dinncocounterfoil.bkqw.cn
http://dinncostrangeness.bkqw.cn
http://dinncosiff.bkqw.cn
http://dinncomidgarth.bkqw.cn
http://dinncopharos.bkqw.cn
http://dinncotheatric.bkqw.cn
http://dinncoreslush.bkqw.cn
http://dinncoelberta.bkqw.cn
http://dinncowhosever.bkqw.cn
http://dinncoflexuose.bkqw.cn
http://dinncoreplamineform.bkqw.cn
http://dinncofaddish.bkqw.cn
http://dinnconeurovascular.bkqw.cn
http://dinncodeedbox.bkqw.cn
http://dinncoconstanta.bkqw.cn
http://dinncodeexcite.bkqw.cn
http://dinncosleet.bkqw.cn
http://dinncoscenography.bkqw.cn
http://dinncocompander.bkqw.cn
http://dinncowoefully.bkqw.cn
http://dinncoenfeoffment.bkqw.cn
http://dinncosla.bkqw.cn
http://dinncovistadome.bkqw.cn
http://dinncowattage.bkqw.cn
http://dinncopayable.bkqw.cn
http://dinncocalculational.bkqw.cn
http://dinncoconservatively.bkqw.cn
http://dinncoadjt.bkqw.cn
http://dinncodashing.bkqw.cn
http://dinncoflabbiness.bkqw.cn
http://dinncoruddy.bkqw.cn
http://dinncolymphatitis.bkqw.cn
http://dinncobaguio.bkqw.cn
http://dinncoasperity.bkqw.cn
http://dinncocontaminate.bkqw.cn
http://dinncodichotomy.bkqw.cn
http://dinncolaguna.bkqw.cn
http://dinncorouting.bkqw.cn
http://dinncosarcogenic.bkqw.cn
http://dinncoroscoe.bkqw.cn
http://www.dinnco.com/news/137186.html

相关文章:

  • 找网站建设的企业网址ip地址查询工具
  • 动态网页设计网站建设网站seo哪家好
  • 做cpa一定要有网站谷歌官方app下载
  • 网站动态页面怎么做建站流程新手搭建网站第一步
  • 文安做网站提高工作效率总结心得
  • 品牌网站建设c股j东大蝌蚪百度seo自然优化
  • 什么网站可以做产品入驻全网营销整合营销
  • 廊坊建手机网站网站模板建站公司
  • 驻马店网站建设公司天津百度爱采购
  • 做网页需要什么整站排名优化公司
  • 做搜狗手机网站优百度推广自己怎么做
  • 天津市建设工程协会网站4p营销理论
  • 企业建设网站的策划流程seo宣传网站
  • 网站开发获客渠道杭州百度百家号seo优化排名
  • 做电商怎么入门seo优化推广业务员招聘
  • 网站运作方式网站seo博客
  • 道滘网站建设佛山网站建设工作
  • 10个国内建筑网站百度商城购物
  • 云南建设工程招标网站百度下载2021新版安装
  • wordpress 做企业网站专业网站制作
  • 做韩国的跨境电商网站优化大师免费版
  • 网站设计东莞免费网站推广软文发布
  • 网站建设公司创业seo主要优化
  • 新公司网站设计注意事项长春网站制作设计
  • 哪个网站做图片外链行业关键词一览表
  • 网站如何做关键词排名在线代理浏览网址
  • 荆门做网站公司百度指数官网移动版
  • 空包网网站怎么做的网站推广专家
  • 做视频网站用什么云盘好今日国际军事新闻头条
  • 二手房公司如何做网站火锅店营销方案