POJ 2472 106 miles to Chicago

第二十七届华东杯数学建模A 题 跳台滑雪问题 完整思路模型及代码 考虑到滑行过程中的空气阻力和摩擦力对速度的影响,我们引入了不同姿态下运动员迎风面积和空气阻力系数的变化,利用牛顿第二定律建立加速度表达式,并通过数值模拟比较常见姿态下的终端速度。针对问题二,我们构建了二维空中飞行动力学模型,结合起跳速度、身体迎角、滑雪板倾角等因素,模拟运动员在空中飞行的轨迹与姿态变化,采用欧拉法对运动过程进行仿真,优化飞行路径和稳定性。仿真结果表明,运动员应在起跳后保持滑雪板与身体成“V”字形打开、重心略后倾的姿态,以增强升力、延长飞行距离并提高姿态得分。,并模拟出跳跃的轨迹和最终得分。 阅读详情

Description

In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook Country Assessor's Office in Chicago. After playing a gig in the Palace Hotel ballroom to earn these 5000 dollars, they have to find a way to Chicago. However, this is not so easy as it sounds, since they are chased by the Police, a country band and a group of Nazis. Moreover, it is 106 miles to Chicago, it is dark and they are wearing sunglasses. 
As they are on a mission from God, you should help them find the safest way to Chicago. In this problem, the safest way is considered to be the route which maximises the probability that they are not caught.

Input

The input contains several test cases. 
Each test case starts with two integers n and m (2 <= n <= 100 , 1 <= m <= n*(n-1)/2). n is the number of intersections, m is the number of streets to be considered. 
The next m lines contain the description of the streets. Each street is described by a line containing 3 integers a, b and p (1 <= a, b <= n , a != b, 1 <= p <= 100): a and b are the two end points of the street and p is the probability in percent that the Blues Brothers will manage to use this street without being caught. Each street can be used in both directions. You may assume that there is at most one street between two end points. 
The last test case is followed by a zero.

Output

For each test case, calculate the probability of the safest path from intersection 1 (the Palace Hotel) to intersection n (the Honorable Richard J. Daley Plaza in Chicago). You can assume that there is at least one path between intersection 1 and n. 
Print the probability as a percentage with exactly 6 digits after the decimal point. The percentage value is considered correct if it differs by at most 10-6 from the judge output. Adhere to the format shown below and print one line for each test case.

Sample Input

5 7
5 2 100
3 5 80
2 3 70
2 1 50
3 4 90
4 1 85
3 1 70
0

Sample Output

61.200000 percent

Source







哎~ 最短路看成了最小生成树,wa了5发,最后还是队友做出了的,

这里我贴出来队友的floyd  我后来写的dijkstra,还有比赛的错误的最小生成树(引以为戒)


队友的:


#include<cstdio>
#include<cstring>
const int maxn=100+10;
#define INF 10000000
double dis[maxn][maxn];
int n,m;

void floyd()
{
   for(int k=1;k<=n;k++)
       for(int i=1;i<=n;i++)
           for(int j=1;j<=n;j++)
              {
                  if(dis[i][j]<dis[i][k]*dis[k][j])
                       dis[i][j]=dis[i][k]*dis[k][j];
              }
}


int main()
{
    int u,v,w;
    while(~scanf("%d",&n),n)
    {
         scanf("%d",&m);
         for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
         {
             if(i==j)  dis[i][j]=0;
             else
                dis[i][j]=dis[j][i]=-1;
         }
         for(int i=1;i<=m;i++)
         {
             scanf("%d%d%d",&u,&v,&w);
             dis[u][v]=dis[v][u]=(w*1.0)/100;
         }
         floyd();
         printf("%.6f percent\n",dis[1][n]*100);
    }
    return 0;
}



dijkstra:


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 105

double a[N][N];
double dis[N];
int vis[N];
int n,m;

void dijkstra()
{
    int i,j,now;

    memset(dis,0,sizeof(dis));
    memset(vis,0,sizeof(vis));

    dis[1]=1;

    for(i=1;i<=n;i++)
    {
        now=1;
        double temp=0;

        for(j=1;j<=n;j++)
          if(!vis[j]&&dis[j]>temp)
          {
              temp=dis[j];
              now=j;
          }



          vis[now]=1;
          for(j=1;j<=n;j++)
            if(!vis[j]&&a[now][j]>0)
          {
                dis[j]=max(dis[j],dis[now]*a[now][j]);
          }
    }

    printf("%.6f percent\n",dis[n]*100);
}
int main()
{
    int i,j;
    while(~scanf("%d",&n),n)
    {
        scanf("%d",&m);
        memset(a,0,sizeof(a));

        int x,y;
        double len;

        while(m--)
        {
            scanf("%d%d%lf",&x,&y,&len);
            a[x][y]=a[y][x]=len*1.0/100;
        }

        dijkstra();
    }
    return 0;
}



错误的最小生成树(至今没有想通,求大神 告诉小弟原因)



#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define N 100005

struct stud{
int a,b;
double s;
}f[N];

int n,m;
int father[1005];


int cmp(stud a,stud b)
{
    return a.s<b.s;
}

int cha(int x)
{
    if(x!=father[x])
        father[x]=cha(father[x]);
    return father[x];
}

void inset()
{
    int i;
    for(i=0;i<1000;i++)
        father[i]=i;
}

void fdd()
{
    int i,j;
    double ans=0;

    for(i=0;i<m;i++)
    {
        inset();
        double x=1;

        for(j=i;j<m;j++)
        {
            int aa=cha(f[j].a);
            int bb=cha(f[j].b);

            if(aa!=bb)
            {
                father[aa]=bb;
                x=f[j].s*x/100;

                if(cha(1)==cha(n))
                {
                    if(ans<x)
                        ans=x;
                    break;
                }
            }
        }
    }

    ans=ans*100;

    printf("%.6f percent\n",ans);
}

int main()
{
    int i;
    while(scanf("%d",&n),n)
    {
        scanf("%d",&m);

        for(i=0;i<m;i++)
            {
            scanf("%d%d%lf",&f[i].a,&f[i].b,&f[i].s);
            }

        sort(f,f+m,cmp);

        fdd();
    }
    return 0;
}




uniapp: err = err.replace(this._UNI_INPUT_DIR_REG, ‘UNI_TypeError: err.replace is not a function问题修复 问题:uniapp的依赖包出现了问题,需要升级解决办法:升级uniapp依赖包,下载"semver"和”@dcloudio/uni-i18n“两个包,本地锁定postcss为7版本,就解决了。 阅读详情

相关推荐

解决 TensorFlow 和 Keras 的 Python 版本兼容问题:详细技术指南

本文提供了TensorFlow和Keras与Python版本不兼容问题的完整解决方案。通过版本对照表指出不同TensorFlow版本对应的Python支持范围,强调2.13.x仅支持Python 3.9-3.11,且不兼容Python 3.12+。给出最佳实践建议:使用虚拟环境管理项目依赖,推荐venv或conda创建独立环境;指导正确安装TensorFlow和Keras版本,建议优先使用tf.keras避免冲突;针对常见报错如DLL加载失败、模块导入错误等提供具体解决方法。最后给出一个在兼容环境中运行的M

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1664

POJ -2472(乘积最短路)

题目链接: 106 miles to Chicago 题意 现在一个逃犯想要逃脱警察的追捕,他有很多路可以走,告诉你了他走这条路不被抓住的概率,现在让你求他从1点走出N点不被抓住的最大概率。 思路 首先概率应该是乘积,所以初始化就会有一些变动,权值代表的是概率,权值为0就代表一定会被抓住,所以一开始的初始化就是都赋值为0,dist[1] = 1,代表到自身一定不会被抓住。然后就是dijkstra了...

“”云腾致雨“”的博客 751

2、通过mos管构成的逻辑门电路

一、总结 mos管 是构成 逻辑门电路 的最基本单元。 各个逻辑门电路的真值表如下: 二、各种门 1、非门 NOT 2、与门 AND 3、与非门 把上面与门电路 右边的 非门电路 去掉 NAND 4、或门 OR 5、或非门 NOR 把或门右边的非门电路去掉 6、异或门 XOR 两个输入相异为1,相同为0。 7、同或门 XNOR 两个输入相同为1,相异为0。 ...

engineer0的博客 4万+

POJ2472:最长路

POJ2472 题意:求从1到n不被逮捕的概率最大 题解: Dijkstra算法不能直接求最长路。按照Dijkstra求下面的从1到2的最长路,会发生错误。必须取反再求。1—2 2,1—3 1,3—4 1,4—2 1。(空格后面是边权) 但是这一题可以用Dijkstra求最大值(47ms)。因为概率≤1,所以越乘越小。比如现在到b点的概率p1为最大,就做标记。那么从其它点跑到b...

FlyingJack 1284

从零构建:毫米波雷达生命信号检测系统的Matlab仿真全流程解析

本文详细解析了毫米波雷达生命信号检测系统的Matlab仿真全流程,涵盖原理、信号处理链路设计及算法优化策略。通过FMCW雷达技术,实现非接触式呼吸心跳信号检测,结合Matlab代码示例展示距离FFT、相位提取与信号分离等关键步骤,为医疗监护和智能家居应用提供实用指南。

weixin_29303701的博客 355

【实验】Linux下完全卸载oracle单实例(亲身体验完整版)

停止oracle数据库服务 停止监听 卸载数据库实例 因为自己懒得再弄dbca图形化界面啥的,直接采用dbca静默删除数据库实例,命令如下 dbca -silent -deleteDatabase -sourcedb orclhq -sid orcl -sysDBAUserName orcl -sysDBAPassword zte [oracle@slave ~]$ dbca -silent ...

萝卜吃鱼914的博客 1945

poj2472解题报告——化用Dijkstra算法

此题是求特定两点之间路径乘积的最大值,可以将原路径值取以小于1的数为底的对数值,然后套用Dijkstra算法即可。         Dijkstra算法与Prim算法很接近,但要明确Dijkstra算法求的是某个特定顶点到其他所有顶点的最短路径,此特定顶点属于特殊点,须最先纳入已找到顶点的集合中;而Prim算法则只是求最小生成树,顶点之间无区别,故第一个纳入已找到顶点集合的可以是任意点。因此,在

江湖中人的专栏 742

极智AI | 谈谈为什么卷积加速更喜欢 NHWC Layout

本文主要讨论一下为什么卷积加速更加喜欢 NHWC 的数据排布。

极智视界 2971

Poj 2472 106 miles to Chicago【Floyd】

106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4692   Accepted: 2120   Special Judge Description In the movie "Blues Brothers", the

mengxiang000000 772

在WIN10系统中安装TIA博途V18,重启后提示安装介质不可用,请插入DVD 或检查网络连接的解决办法

在WIN10系统中安装TIA博途V18,重启后提示安装介质不可用,请插入DVD 或检查网络连接的解决办法

Robot_PLC_HMI_Automation 1万+

手把手教你学Simulink——基于Simulink的储能PCS(功率转换系统)离网V/f控制仿真示例

本文带你从零开始,在Simulink中硬核还原了一套完整的100kW 储能PCS离网V/f控制系统。通过引入:✅无PLL的自主角度生成机制(实现真正的“构网”能力)✅电压外环与电流内环的双闭环解耦架构(兼顾稳态精度与动态响应)✅黑启动软充电与有源阻尼等工程化手段(确保系统平滑建压与抗谐振)核心收获透彻理解了储能系统在无大电网支撑下的自主运行机理。掌握了从“跟网(Grid-Following)”向“构网(Grid-Forming)”跨越的控制算法核心差异。

MHD0815的博客 77

POJ 2472 迪杰斯特拉计算最长路

需要注意的就是自己到自己是百分之百 其实用Floyd算法更加简便。因为时间限制是2秒。 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;algorithm&gt; #include&lt;cstring&gt; #include&lt;string&gt; #include&lt;map&gt; #include&lt;v...

兜率工的博客 2384

流媒体服务软件-LiveNVR channeltree 未授权访问

LiveNVR 能够通过简单的网络摄像机通道配置,将传统监控行业里面的高清网络摄像机 IPCamera、NVR 等具有 RTSP/Onvif 协议输出的设备接入到 LiveNVR,LiveNVR 能够将这些设备源的音/视频数据进行采集、转换、输出,进行全平台终端直播(PC、Android、iOS、微信、H5),并且LiveNVR能够将视频源的直播数据对接到第三方 CDN 网络,实现安防设备互联网级别的直播分发。对channeltree接口加上权限校验。直接访问接口即可获取数据。

iSee857的博客 1040

poj 2472 106 miles to Chicago

因为求安全性最大的路径,所以可以将dist[1]定为-1,再作spfa处理 //poj 2472 106 miles to Chicago /* * 因为求安全性最大的路径,所以可以将dist[1]定为-1,再作spfa处理 * spfa(st) 之后有dist[]得到距离 */ //licatweijei #include using namespace std; #def

LiWeiJie的专栏 657

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

poj 2472 106 miles to Chicago floyd

View Code #include <stdio.h>#include <string.h>int n,m;double map[105][105];void floyd(){ int i,j,k; for (i=1;i<=n;i++) { for (j=1;j<=n;j++) { ...

diaopi1575的博客 190

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

POJ 2472 106 miles to Chicago

106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3305   Accepted: 1557   Special Judge Description In the movie "Blues Brothers", the orp...

weixin_34149796的博客 87

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

POJ-2472 106 miles to Chicago

106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65M         Special Judge Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were ra

JSure的代码库 1090

POJ 2472 106 miles to Chicago(最短路)

题目连接:http://poj.org/problem?id=2472 题意:男孩要从1到n城市,每条道路有他不被抓的百分比,输出他到n不被抓的最大概率。 题目的数据有些问题,边开到20W才过,求最长路径即可。 参考代码: #include #include #include #include using namespace std; #define INS 0.0 #define

fire__ice的专栏 736

POJ2472 106 miles to Chicago SPFA

一道最长路径,我分别试了两种方法,spfa 和 floyd 106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 2977   Accepted: 1401   Special Judge Description In the

834

【POJ】2472 106 miles to Chicago 最短路

传送门:【POJ】2472 106 miles to Chicago 题目分析:

poursoul 804

POJ 2472:106 miles to Chicago

Description Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook Coun

jjs98 673

POJ2472 106 miles to Chicago

简单最长路径,一个小技巧就是将每条边权值取对数,然后SPFA一次就可以了 #include #include #include using namespace std; const int MAXN = 110; const int MAXM = MAXN*MA

云游code的博客 1023

POJ 2472 106 miles to Chicago

题目链接题意:给定一张图,每条路有一定权值,代表不会被抓到的概率。求概率最大值。分析:对概率取对数后再去负号,相当于求最短路。裸的dijkstra.#include<stdio.h> #include <iomanip> #include<iostream> #include<cmath> using namespace std; const int MAX_N = 100; const doubl

HYB733093411的博客 397
上一篇: POJ 1840 数学
下一篇: POJ 3187 Backward Digit Sums(dfs)
左眼皮跳跳~
博客等级 码龄13年 17粉丝 400原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值