河南网站建设报价公司网站开发 nodejs

张小明 2026/1/12 15:38:40
河南网站建设报价,公司网站开发 nodejs,国外企业网站模板,网络营销策划的产品层次有哪些2025年浙江大学计算机考研复试机试真题 2025年浙江大学计算机考研复试上机真题 历年浙江大学计算机考研复试上机真题 历年浙江大学计算机考研复试机试真题 更多学校题目开源地址#xff1a;https://gitcode.com/verticallimit1/noobdream N 诺 DreamJudge 题库#xff1…2025年浙江大学计算机考研复试机试真题2025年浙江大学计算机考研复试上机真题历年浙江大学计算机考研复试上机真题历年浙江大学计算机考研复试机试真题更多学校题目开源地址https://gitcode.com/verticallimit1/noobdreamN 诺 DreamJudge 题库输入 “学校名称” 即可筛选该校历年机试真题题目均在考纲范围内按难度自动排序。还可搭配《计算机考研机试攻略》刷题书中题目可通过题号直接在题库中查找。最短路径问题题目描述Time Limit: 1000 msMemory Limit: 256 mb给你n个点m条无向边每条边都有长度d和花费p给你起点s终点t要求输出起点到终点的最短距离及其花费如果最短距离有多条路线则输出花费最少的。输入输出格式输入描述:输入n,m点的编号是1~n,然后是m行每行4个数 a,b,d,p表示a和b之间有一条边且其长度为d花费为p。最后一行是两个数 s,t;起点s终点t。n和m为0时输入结束。 (1n1000, 0m100000, s ! t)输出描述:输出 一行有两个数 最短距离及其花费。输入输出样例输入样例#:3 2 1 2 5 6 2 3 4 5 1 3 0 0输出样例#:9 11代码一#include iostream#include vector#include algorithm#include iomanip#include set#include list#include string#include cmath#include stack#include map#include sstream#include queueusing namespace std;struct edge {int target;int length;int cost;};vectorintdist;vectorintcost;struct compare_dist {bool operator()(int a, int b) {return dist[a] dist[b];}};int main() {int n, m;while (cin n m) {if (n 0)break;mapint, vectoredgegraph;dist.resize(n 1); cost.resize(n 1);for (int i 1; i n; i) {dist[i] 1e9;cost[i] 1e9;}int node1, node2, length3, cost3;for (int i 0; i m; i) {cin node1 node2 length3 cost3;edge temp; temp.target node2; temp.cost cost3; temp.length length3;graph[node1].push_back(temp);temp.target node1;graph[node2].push_back(temp);}int s, t;cin s t;dist[s] 0; cost[s] 0;priority_queueint, vectorint, compare_distpq;pq.push(s);while (!pq.empty()) {int curr_node pq.top(); pq.pop();if (curr_node t)break;if(!graph[curr_node].empty()){for (auto v : graph[curr_node]) {int new_dist dist[curr_node] v.length;int new_cost cost[curr_node] v.cost;if (new_dist dist[v.target]) {dist[v.target] new_dist;cost[v.target] new_cost;pq.push(v.target);}else if (new_dist dist[v.target] new_cost cost[v.target]) {cost[v.target] new_cost;pq.push(v.target);}}}}cout dist[t] cost[t] endl;}return 0;}代码二#include iostream#include vector#include queueusing namespace std;struct Edge{int x,y,d,p;};struct Node{int x,d,p;friend bool operator (Node a, Node b){if(a.d b.d) return a.p b.p;return a.d b.d;}};const int maxN 1000;const int INF 0x3f3f3f3f;vectorint e[maxN5];vectorEdge edges;int dis[maxN5];int prices[maxN5];bool vis[maxN5];void addEdge(int a, int b, int d, int p){e[a].push_back(edges.size());edges.push_back({a,b,d,p});}int dijkstra(int s){dis[s] 0;prices[s] 0;priority_queueNode pq;pq.push({s,0,0});while(!pq.empty()){Node now pq.top();vis[now.x] true;pq.pop();for(int i 0; i e[now.x].size(); i){Edge edge edges[e[now.x][i]];if(dis[edge.y] dis[edge.x]edge.d|| dis[edge.y] dis[edge.x]edge.d prices[edge.y] prices[edge.x]edge.p){dis[edge.y] dis[edge.x]edge.d;prices[edge.y] prices[edge.x]edge.p;pq.push({edge.y, dis[edge.y],prices[edge.y]});}}}return 0;}int main() {int n,m;int a,b,d,p;int s, t;while(cin n m){if(n 0 m 0)break;for(int i 1; i n; i){dis[i] INF;prices[i] INF;}for(int i 0; i m; i){cin a b d p;addEdge(a,b,d,p);addEdge(b,a,d,p);}cin s t;dijkstra(s);cout dis[t] prices[t] endl;}return 0;}代码三#include bits/stdc.husing namespace std;const int INF 0x3f3f3f3f;int n,m;const int maxn 1001;struct edge {int u,v,w,p;edge(int _u, int _v, int _w,int _p) : u(_u), v(_v), w(_w), p(_p){}};vectoredge edges;vectorint G[maxn];//每个点的边在edges中的下标int vis[maxn];int dist[maxn];int path[maxn];int cost[maxn]; //从起点到某个点i的最少花费cost[i],但是是在距离最短优先情况下void spfa(int s) {queueint q;q.push(s);for(int i 0; i n; i) {dist[i] INF;}dist[s] 0;memset(cost,0,sizeof(cost));memset(vis,0,sizeof(vis));while(!q.empty()) {int u q.front();q.pop();vis[u] 0;for(int i 0; i G[u].size(); i) {edge e edges[G[u][i]];if(dist[e.v] dist[u] e.w) {dist[e.v] dist[u] e.w;path[e.v] u;cost[e.v] cost[u] e.p;if(vis[e.v] 0) {q.push(e.v);vis[e.v] 1;}}else if(dist[e.v] dist[u] e.w) {int new_cost cost[e.u] e.p;if(new_cost cost[e.v]) {cost[e.v] new_cost;path[e.v] u;}}}}}void addedge(int a, int b,int c, int d) {edges.push_back(edge(a,b,c,d));G[a].push_back(edges.size()-1);}void init() {for(int i 0; i n ;i) G[i].clear();edges.clear();}int main() {while(cinnm) {if(n 0 m 0) break;init();int a,b,c,d;for(int i0;im;i) {cinabcd;addedge(a,b,c,d);addedge(b,a,c,d);}int s,t;cin s t;spfa(s);cout dist[t] cost[t] endl;}}
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

网站有什么做企业网站需要买什么

FastAPI-MCP:零配置实现AI模型与API的无缝集成 【免费下载链接】fastapi_mcp 一种零配置工具,用于自动将 FastAPI 端点公开为模型上下文协议 (MCP) 工具。 项目地址: https://gitcode.com/GitHub_Trending/fa/fastapi_mcp 你是否曾面临这样的困境…

张小明 2026/1/11 5:11:01 网站建设

公司网站建设多少钱北京+网站建设

文章详细对比了7种主流大模型部署框架(Transformers、ModelScope、vLLM、LMDeploy、Ollama、SGLang和DeepSpeed),从技术架构、优缺点和适用场景进行分析,并给出不同场景下的选型建议:个人开发者适合Ollama或Transforme…

张小明 2026/1/8 4:44:20 网站建设

佛山seo整站优化天津设计公司

每天打开电脑,桌面被4、5个微信窗口占满——这是不是你作为微信运营/客服的日常?多号切换的繁琐、消息遗漏的风险、协作沟通的成本,把原本简单的客服工作变得又累又低效。微信管理系统诞生了,精准戳中多号运营的所有痛点&#xff…

张小明 2026/1/9 7:44:43 网站建设

wamp环境下做网站微商城开发lk华网天下价格合适

Langchain-Chatchat能否支持多语言文档处理? 在企业知识管理日益复杂的今天,一个常见的现实挑战浮出水面:如何让一份包含中、英、法、德等多种语言的技术文档集变得“可对话”?用户希望用中文提问,却能准确检索到英文报…

张小明 2026/1/8 18:15:43 网站建设

网站制作上哪学校网络营销就业前景怎么样

在 Web 开发中,大多数人每天都在编写 HTTP 接口,却很少真正思考一个问题:如果服务端需要“主动”把消息推送给客户端,该怎么办? 传统的 HTTP 请求–响应模型决定了通信只能由客户端发起,这在即时通信、实时…

张小明 2026/1/8 3:18:35 网站建设

厦门网站营销广西seo排名

✅ 博主简介:擅长数据搜集与处理、建模仿真、程序设计、仿真代码、论文写作与指导,毕业论文、期刊论文经验交流。✅ 具体问题可以私信或扫描文章底部二维码。1) 构建基于时空网络的客流协同控制优化模型,以最小化乘客总等待时间为目标。时空网…

张小明 2026/1/8 4:44:18 网站建设