hdu2923

ARTIX-7 GTP 3G-SDI 工程构建与调试实战 本文详细介绍了基于ARTIX-7 FPGA和GTP收发器的3G-SDI工程构建与调试实战。从基础概念解析到Vivado工程创建、GTP IP核配置、SDI IP核集成,再到系统集成与时钟域处理,提供了全面的技术指导。文章还分享了调试技巧、常见问题排查方法以及性能验证步骤,帮助开发者快速掌握3G-SDI视频传输技术的实现与优化。 阅读详情

Einbahnstrasse

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1331    Accepted Submission(s): 364


Problem Description
Einbahnstra   e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother flow of traffic through crowded areas. This is useful in city centers, especially old cities like Cairo and Damascus. Careful planning guarantees that you can get to any location starting from any point. Nevertheless, drivers must carefully plan their route in order to avoid prolonging their trip due to one-way streets. Experienced drivers know that there are multiple paths to travel between any two locations. Not only that, there might be multiple roads between the same two locations. Knowing the shortest way between any two locations is a must! This is even more important when driving vehicles that are hard to maneuver (garbage trucks, towing trucks, etc.)

You just started a new job at a car-towing company. The company has a number of towing trucks parked at the company's garage. A tow-truck lifts the front or back wheels of a broken car in order to pull it straight back to the company's garage. You receive calls from various parts of the city about broken cars that need to be towed. The cars have to be towed in the same order as you receive the calls. Your job is to advise the tow-truck drivers regarding the shortest way in order to collect all broken cars back in to the company's garage. At the end of the day, you have to report to the management the total distance traveled by the trucks.
 

Input
Your program will be tested on one or more test cases. The first line of each test case specifies three numbers (N , C , and R ) separated by one or more spaces. The city has N locations with distinct names, including the company's garage. C is the number of broken cars. R is the number of roads in the city. Note that 0 < N < 100 , 0<=C < 1000 , and R < 10000 . The second line is made of C + 1 words, the first being the location of the company's garage, and the rest being the locations of the broken cars. A location is a word made of 10 letters or less. Letter case is significant. After the second line, there will be exactly R lines, each describing a road. A road is described using one of these three formats:


A -v -> B
A <-v - B
A <-v -> B


A and B are names of two different locations, while v is a positive integer (not exceeding 1000) denoting the length of the road. The first format specifies a one-way street from location A to B , the second specifies a one-way street from B to A , while the last specifies a two-way street between them. A , ``the arrow", and B are separated by one or more spaces. The end of the test cases is specified with a line having three zeros (for N , C , and R .)

The test case in the example below is the same as the one in the figure. 

 

Output
For each test case, print the total distance traveled using the following format:


k . V


Where k is test case number (starting at 1,) is a space, and V is the result.
 

Sample Input
  
4 2 5 NewTroy Midvale Metrodale NewTroy <-20-> Midvale Midvale --50-> Bakerline NewTroy <-5-- Bakerline Metrodale <-30-> NewTroy Metrodale --5-> Bakerline 0 0 0
 

Sample Output
  
1. 80
 

Source
 

Recommend
lcy
 


两次dijkstra即可

#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#define inf 99999999
using namespace std;
int m[105][105];
char t1[50];
char t2[50];
int num[1005];
int d[105];
int n;
void dijkstra()
{
    int vis[105];
    int i;
    for(i=1;i<=n;i++)
        d[i]=inf;
    d[1]=0;
    memset(vis,0,sizeof(vis));
    for(i=1;i<=n;i++)
    {
        int mm=inf,x,y;
        for(y=1;y<=n;y++)
        {
            if(!vis[y]&&d[y]<mm)
                mm=d[x=y];
        }
        vis[x]=1;
        //printf("%d",x);
        for(y=1;y<=n;y++)
        {
            if(m[x][y]!=-1&&d[y]>d[x]+m[x][y])
                d[y]=d[x]+m[x][y];
        }
    }
}
void tran()
{
    int i,j;
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            int t=m[i][j];
            m[i][j]=m[j][i];
            m[j][i]=t;
        }
    }
}
int main()
{
    int c,r;
    int cas=0;
    while(scanf("%d%d%d",&n,&c,&r))
    {
        if(n==0&&c==0&&r==0)
            break;
        int i;
        cas++;
        memset(m,-1,sizeof(m));
        map<string,int> map;
        char car[50];
        int k=1;
        for(i=0;i<c+1;i++)
        {
            scanf("%s",car);
            if(map[car]==0)
                map[car]=k++;
            num[i]=map[car];
        }
        char a1,a2,a3,a4;
        int w;
        for(i=0;i<r;i++)
        {
            cin>>t1>>a1>>a2>>w>>a3>>a4>>t2;
            if(map[t1]==0)
                map[t1]=k++;
            if(map[t2]==0)
                map[t2]=k++;
            int u=map[t1];
            int v=map[t2];
            if(a1=='<'&&(m[v][u]==-1||m[v][u]>w))
                m[v][u]=w;
            if(a4=='>'&&(m[u][v]==-1||m[u][v]>w))
                m[u][v]=w;
        }
        int j;
        int res=0;
        dijkstra();
        for(i=0;i<c+1;i++)
            res+=d[num[i]];
        tran();
        dijkstra();
        for(i=0;i<c+1;i++)
            res+=d[num[i]];
        printf("%d. %d\n",cas,res);
    }
    return 0;
}


com.sap.aii.af.service.cpa.CPAObjectNotFoundException: Couldn‘t retrieve inbound binding 错误消息:错误截图:该错误通常表示在集成配置中,未找到与特定消息匹配的入站绑定(Inbound Binding)。具体而言,错误消息中的 P/S/A(Party/Service/Action)值未在配置中找到对应的入站绑定。 阅读详情

相关推荐

VPI与Matlab协同仿真:相干光通信接收端DSP算法全解析

本文详细解析了如何利用VPI与Matlab协同仿真,构建完整的相干光通信接收端DSP算法处理闭环。重点介绍了从VPI导出数据后,在Matlab中实现时钟恢复、偏振解复用和载波相位估计等核心算法的步骤与原理,并阐述了如何通过误码率计算完成仿真验证,为相干光通信系统算法研究与验证提供了高效实用的方法。

ll5678的博客 611

HDU 2923 Einbahnstrasse(两种方法)

Problem Description Einbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother flow

他说少年如歌 553

广东电信兆能Z82盒子救砖记:手把手教你用U盘强刷HI3798MV100固件(附短接图)

本文详细介绍了广东电信兆能Z82盒子变砖后的救砖方法,重点讲解了使用U盘强刷HI3798MV100固件的全流程,包括诊断、准备工作、短接操作及刷机后的优化设置。特别针对m8233主板和8188无线方案的机型,提供了实用的短接图和操作技巧,帮助用户成功恢复设备。

weixin_30325487的博客 403

HDU2923:Einbahnstrasse(Floyd)

Problem Description Einbahnstra  e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother f

ACM!荣耀之路! 2839

OpenCv案例(七): 基于OpenCvSharp计算图像的清晰度(自动对焦)

自动对焦,其实是对相机成像的清晰值得计算,若对焦不清晰,成像的清晰度低,视觉效果模糊。若是在工业检测行业,对焦不准确,可能会造成严重后果;对焦准确的图像,其清晰度高,对比度鲜明,层次明显。

qq_37835727的博客 7114

泛微E9统一待办接口说明

需要第三方表单,在提交自己的流程后,通过【window.location.href=‘oa地址/workflow/request/ViewRequestOS.jsp?需要第三方表单,在提交自己的流程后,通过【window.location.href=‘oa地址/workflow/workflow/WfRefreshList.jsp’】通过中转页面与第三方系统对接,按照第三系统的验证方式开发中转页面中的程序。C)第三方根据相同的数据加密,结果一致就认证成功,打开流程。优点:可以灵活的对接各个系统。

泛微二次开发后端知识总结 6396

HDU-2923-Einbahnstrasse

ACM模版描述 题解好长的英文题,看得我都心碎了~~~百度了一下大意: 三个数字n、c、r,n代表城市的个数,c代表损坏的车辆的数量,r代表有几条路,然后接下去有c+1个字符串,第一个代表拖车公司的所在地,后面的c个地点表示损坏的需要拖回来的车辆所在地。在接下去r个字符串,代表r条路,左右为两个城市名,中间的一串字符中,只含有<-代表该条路是从右边的城市通向左边的,以此类推,而数字代表该条路的长

逐梦者 546

32位快速加法器设计

32位快速加法器设计

好好学习,天天向上 3290

hdu 2923

最短路加字符串处理 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <cstring> #include <cstdlib> #include <map> using...

weixin_30763397的博客 158

10万+字超硬核 机器学习 笔记(面试八股)

10w字总结面试中可能用到的机器学习八股和常用算法,包括感知机(Perceptron)、多层感知机(MLP, Multi-Layer Perceptron)、支持向量机(SVM, Support Vector Machine)、K 最近邻(KNN, K-Nearest Neighbors)、朴素贝叶斯(Naive Bayes)、决策树(Decision Tree)、随机森林(Random Forest)、Bagging、Boosting、GBDT、XGBoos、LightGBM等。

haopinglianlian的博客 4658

20、基于图神经网络的脱氢焓预测方法研究

本文研究了基于图神经网络(GNN)的液态有机氢载体(LOHC)材料脱氢焓预测方法。通过分析现有GNN方法的局限性,提出了一种新的聚合自节点表示(AWS)方法,并结合丰富的原子特征和集成学习策略,显著提高了预测性能。实验结果表明,AWS在脱氢焓预测和多个基准化学性质预测任务中均优于现有GNN方法。此外,基于分子结构的集成方法进一步提升了模型的鲁棒性和准确性。研究展示了该方法在筛选LOHC材料中的潜力,并为未来预测更多化学性质奠定了基础。

pp12345的博客 103

Hdu 2923(最短路)

hdu 2923 思路: 从修理厂到各个修车地点的距离L1,然后再到修理厂L2,总共c辆坏车, 求∑(L1+L2)的最小值, 可以先正项建图,求出修车厂到各个坏车点的距离L1, 然后逆向建图,求出坏车点到修车厂的最小距离。 注意: (1)有重边,用邻接表不用考虑,临街矩阵要保证每条边最短 (2)输出的格式,特判时也要注意格式。 #include<iostre...

积少成多,水滴石穿 260

智慧加油站小程序数据库设计文档

【代码】智慧加油站小程序数据库设计文档。

低代码布道师的博客 1403

hdu 2923Einbahnstrasse(spfa/floyd+map)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2923 题目意思:有n个城市,城市是用字符串表示的,c个城市有坏的车,r条有向有权道路,求从你在所在的城市,将坏的车拖回来的花费。 思路:思路蛮简单,就是用map将城市(字符串)转化成编号,再求最短路,就是map处理稍微复杂点。 开始我没仔细看数据大小,用spfa做的,代码量...

agyohust791263的博客 230

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

hdu 2923 Einbahnstrasse

点击打开链接hdu 2923 思路:最短路+SPFA / 最短路+floyd 分析: 1 题目要求的是有n个点,然后有c个破车,这个c个破车可能在同一城市里面,现在要把这些破车统一拉到中心点1. 2 这题的中心在1点,那么所求 ans = 1-&gt;所有破车的距离之和 + 所有破车-&gt;1的之和。所以这里涉及到1-&gt;所有破车的距离 和 所有破车-&gt;1的距离,那么我们可...

我是传奇 177

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

HDU - 2923 Einbahnstrasse 【floyd】

点击打开链接 题意(此题最难部分!) :  给你呢个城市,给你c辆坏车,给你坏车的城市,然后给你路径。 求最短费时,一次只能拖一辆。 题解:  floyd 跑一遍,只要是读入可能看着很烦人。 注意有重边 竟然把sum,c,ca,x,y定 义成 char   答案还对。 wa到爆炸。   #include #include using names

zoro_n的博客 362

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

HDU-2923-Einbahnstrasse(map+反向建图)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2923 题意:给你三个数 n, c, r,分别代表n 个地点(包括公司的车库地点和车抛锚的地点),c 表示c辆车抛锚的地点, r 条道路 第二行给出 c+1 个地点,第一个为车库地点, 其余的 c 个为车抛锚的地点。 接下来的 r 行表示 r 条有向的道路(一共有三种形式): A--V-&gt;...

sugarbliss 403

Hdu 2923 MAX Average Problem (DP_斜率优化)

Hdu 2923 MAX Average Problem (DP_斜率优化) 分类: 全部博客 ACM_好题经典题 ACM_动态规划(DP)2012-08-22 00:33 336人阅读 评论(0) 收藏 举报 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2993 题目大意:给定一个长度为n的序列,从其中找

pi9nc的专栏 762

HDU 2923 Einbahnstrasse

题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2923EinbahnstrasseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3780 Accepted Submiss

moonlight的博客 314

hdu2923—Einbahnstrasse(spfa)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2923 Einbahnstrasse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3591    Accepted Subm

zhiyuanjiang的博客 377

HDU 2923

//这两天做的最短路,基本上都和字符串扯上关系了,都要用map容器,尤其是这题,写起代码来有点耗时间, //而且要注意的细节特别多,只要多刷刷这样的题目,下次看到这样的题目,就不会那么 //害怕了,知道一步一步来,用map来解决问题! // // // #include #include #include #include #include #include using names

傻笨 579

HDU 2923 Einbahnstrasse(Floyd)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2923 题目大意:你需要将C个车库的若干辆破车用拖车拖去公司,司机是一位娴熟的老司机,因此他知道如何走才能使总路程最短,而你需要做的就是输出这个最短路径。这道题我们需要注意的是它两个点之间是可能有重边的,而且这道题目还有一个隐藏条件,你每次用拖车将破车拖至公...

asdfghjkl999999999的博客 178

hdu 2923 Floyd The shortest route

Be Attention ,These is may be a  locality has more than one broken-car .Clearly,Floyd is simple than Dijkstra in this problem. The portal:http://acm.hdu.edu.cn/showproblem.php?pid=2923 /************

NM的专栏 541

HDU 2923 Einbahnstrasse

链接: http://acm.hdu.edu.cn/showproblem.php?pid=2923 题目: Einbahnstrasse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1117    Ac

D_Double's Journey 1211
上一篇: hdu1546 dijkstra
下一篇: hdu 3339 最短路+01背包
JustSteps
博客等级 码龄14年 48粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值