UVA11722Joining with Friend概率dp

利用MATLAB 4f光学系统,在Python中进行弗劳恩霍夫衍射和傅里叶面滤波——用镜头模拟光学图像处理。.zip 1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。 立即下载
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double t1,t2,s1,s2,w;
//取t为x轴,s为y轴
double geta(int b){//y=x+b,-90<=b<=90,取与四线的交点进行比较
    int y1=t1+b,y2=t2+b;
    if(y2<s1) return 0;
    if(y1<s1){
        if(y2<s2) return 0.5*(y2-s1)*(t2-(s1-b));
        else return 0.5*(s2-s1)*(t2-(s1-b)+t2-(s2-b));
    }
    if(y1<s2){
        if(y2<s2) return 0.5*(t2-t1)*(y1-s1+y2-s1);
        else return (t2-t1)*(s2-s1)-0.5*(s2-y1)*(s2-b-t1);
    }
    return (t2-t1)*(s2-s1);
}

int main()
{
    int T,cas=0;
    cin>>T;
    while(T--){
        scanf("%lf%lf%lf%lf%lf",&t1,&t2,&s1,&s2,&w);
        double ans=(t2-t1)*(s2-s1);
        printf("Case #%d: %.8lf\n",++cas,(geta(w)-geta(-w))/ans);
    }
    return 0;
}

工业互联网工控安全与工业质检AI大模型建设方案.pptx 立即下载

相关推荐

通信行业CentOS 7内核网络栈优化:高并发连接下UDP/TCP性能调优与系统资源管理

内容概要:本文聚焦于CentOS 7系统在通信行业高并发场景下的性能调优实践,重点围绕内核网络栈优化展开,涵盖UDP/TCP缓冲区调整、文件句柄与连接跟踪表扩容、TIME_WAIT状态复用、软中断分布优化及tuned工具的自动化调优。通过具体配置参数和实际案例(如VoIP软交换系统)深入解析各项调优措施的设计原理与实施效果,有效解决高CPS下丢包、连接失败等问题,并展望了向云化、eBPF等动态智能调优方向的发展趋势。; 适合人群:从事通信系统运维、网络开发或Linux系统性能优化的技术人员,具备一定操作系统和网络基础知识,工作经验1年以上的中初级工程师。; 使用场景及目标:①应用于软交换、媒体网关、信令网关等高并发通信设备的系统调优;②解决UDP丢包、conntrack表满、TCP连接队列溢出等典型性能瓶颈;③提升系统在小包高频、低时延要求场景下的稳定性和吞吐能力。; 阅读建议:建议结合实际生产环境或测试平台同步验证文中配置,重点关注参数背后的物理意义(如BDP、softirq、conntrack机制),并配合ss、conntrack、dmesg等命令进行调优前后对比分析,确保安全可控地实施变更。

UVa 11722 (概率 数形结合) Joining with Friend

高中也做个这种类似的题目,概率空间是[t1, t2] × [s1, s2]的矩形,设x、y分别代表两辆列车到达的时间,则两人相遇的条件就是|x - y| <= w 从图形上看就是矩形夹在两条平行线之间的部分。 因为情况众多,一个一个分类很麻烦,而且可能有漏掉情况,所以就用计算几何的办法求了个凸多边形,多边形 与 矩形面积之比就是概率。 代码有点挫,将就看,=_=|| 1 #...

weixin_30908649的博客 97

2024 《计算机网络》实验教学指导书.doc

2024 《计算机网络》实验教学指导书.doc

UVA - 11722 Joining with Friend (概率)

You are going from Dhaka to Chittagong by train and you came to know one of your old friends is going from city Chittagong to Sylhet. You also know that both the trains will have a stoppage at junctio

那些年 1375

不平衡电网下自抗扰顺序模型预测PWM整流器控制仿真模型(Simulink仿真实现)

内容概要:本文围绕面向城市空中交通的多无人机路径规划问题展开研究,提出了一套融合全局规划、动态避障与局部协同调整的综合路径规划方法。研究内容涵盖基于改进RRT算法与图论的全局路径规划、基于动态风险场和动态窗口法(DWA)的模型预测控制实现动态避障,以及基于分布式协同控制的多无人机局部路径协同策略。通过Matlab平台构建仿真环境,在多种典型城市交通场景下对所提方法进行了系统性验证,结果表明该方法在路径安全性、编队稳定性与任务效率方面表现优异。文章还深入探讨了算法的创新点与未来研究方向,为复杂城市环境下多无人机系统的自主协同提供了理论支撑与技术路径。; 适合人群:具备自动化、控制理论、计算机科学或相关领域基础知识,从事无人机系统、智能交通、路径规划、多智能体协同控制等方向研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①为城市空中交通系统中的多无人机安全、高效飞行提供可靠的路径规划解决方案;②支持在复杂、动态的城市场景中开展无人机自主导航、编队飞行与协同控制的技术研究与仿真验证。; 阅读建议:建议结合提供的Matlab代码进行实践操作,重点关注算法的具体实现细节、参数配置对性能的影响以及不同仿真场景下的实验设计,以深入理解各模块的集成逻辑与实际应用效果。

神经元细胞结构刨析(持续更新)

神经细胞的学习笔记

weixin_46596227的博客 2219

uva 11722 - Joining with Friend(概率)

题目连接:uva 11722 - Joining with Friend 题目大意:你和朋友乘火车,并且都会路过A市,给定两人可能到达A市的时段,火车会停w,问说两人可以见面的概率。 解题思路:y = x + w 和y = x - w在给定时间内围成的面积除以时间的总面积,就是求面积的时候要分情况处理。 #include #include #include using nam

不慌不忙、不急不躁 1696

Basilisk库教程

要在仿真中执行模块,其调度由Basilisk的[Process]和[Task]容器控制。BSK[Task]包含一系列模块,这些模块都以相同的更新频率执行。一个[Process]本质上是一个任务组,可以包含多个相关的任务。例如,在多星仿真中,你可以为每颗卫星创建一个[Process],以便将相关任务和嵌入式模块有序地组织起来。下图展示了一个示例布局,其中bskSat卫星的动力学被添加到与飞行软件(FSW)算法分开的进程中,这些算法在该卫星上执行。在每个进程中,设置了若干任务,这些任务以指定的频率进行评估。

weixin_57997461的博客 1135

概率与数学期望例题——uva11722(图形面积与概率)

Joining with Friend   UVa11722PDF首先我们当然看一下原题。中文翻译:你和朋友都要坐火车,并且都会经过A市,你们很像会面,但是你们到达这个城市的准确时间无法确定。你会在时间区段[t1,t2],中的忍一时可以相同的概率密度到达,你的朋友则会在[s1,s2]中的任意时刻到达,你们的火车会在A市停留w分钟。输入格式:第一行为数据组数T,接下来的T行每行包含5个整数,分别为t...

编程竞赛过程记录—学习笔记 1677

Unity 第一人称视角控制移动、旋转

第一人称视角操作此功能主要是借鉴YouTube,写的蛮好我就搬运过来让大家也试试。

qq_36515472的博客 4201

基于小波变换的信号降噪处理及仿真研究_信号处理方法推荐--1(转载自用,侵删)...

综述作者:aresmiki链接:https://www.zhihu.com/question/23701194/answer/167005497来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。非平稳信号处理应该是现在信号处理技术最新的也是最热的研究方向了,信号处理方法从最早的时域统计到傅里叶变换的频域分析,是人们认识信号本质的一次巨大飞跃,给了分析人员换个角度看世界的...

weixin_32144483的博客 1249

UVA 11722二维线性规划

1 /*UVA 11722 2 简单二维线性规划问题: 3 输入:5 integers t1, t2, s1, s2, w (360 ≤ t1 < t2 < 1080, 360 ≤ s1 < s2 < 1080 and 1 ≤ w ≤ 90). 4 目标函数:0<=|s-t|<=w;计算目标的补集更简单 5 步骤:画出坐标轴,注意分类讨论;...

weixin_30572613的博客 225

Proxmox VE网络配置踩坑实录:从Web界面无法访问到完美修复的全过程

本文详细记录了Proxmox VE服务器Web界面无法访问的完整排查与修复过程。作者从基础网络连通性测试入手,逐步排查了服务状态、SSL证书、端口监听、防火墙规则及网关配置,最终定位并解决了问题。文章提供了系统性的故障排查思路和实用的修复命令,对管理Proxmox VE网络具有重要参考价值。

weixin_29231221的博客 887

概率和数学期望基础题

uva 11021 Tribbles 每只麻球都是独立的,所以先单独考虑一只麻球的繁殖情况,设f(i)表示i天之后全部死亡的概率,f(i)=p0+p1*f(i-1)+p2*f(i-1)^2+....p(n-1)*f(i-1)^(n-1) 分别表示:一只,一只也没出生的概率,一只自然死亡;出生两只,一只自然死亡,剩下i-1天全部死完的概率f(i-1)^2 ;.......;出生n-1只,一只自然死

shiyuan的专栏 2367

西门子1200PLC编程实战:OB、FC、FB与DB的深度解析与应用技巧

本文深度解析西门子1200PLC编程中OB、FC、FB与DB四大核心功能块的应用技巧。通过工厂化比喻,阐明OB作为程序总调度、FC作为可重用函数、FB作为带记忆的智能设备以及DB作为数据仓库的角色与关系,并提供实战技巧,帮助工程师构建结构清晰、易于维护的高效PLC程序。

weixin_29280657的博客 440

YOLO系列算法改进 | C3k2改进篇 | 融合DEConv细节增强卷积模块 | 细节增强+多分支差分卷积融合,标准卷积的完美涨点替代! | TIP 2024

YOLO系列算法改进 | C3k2改进篇 | 融合DEConv细节增强卷积模块 | 细节增强+多分支差分卷积融合,标准卷积的完美涨点替代! | TIP 2024 (以YOLO26最新目标检测模型为基础,融合C3k2_DEConv创新模块进行改进)

2502_91881744的博客 310

uva11722 Joining with Friend

几何概率

YHaX的博客 419

昇腾,Ascend,NPU,mindie,镜像,部署vllm:第5篇,昇腾环境下部署蒸馏版deepseek-r1,并在dify中注册模型供应商

这两天没少折腾deepseek-r1。之前在A100上用ollama部署了一份DeepSeek-R1-Distill-Qwen-32B,感觉真的特别慢。现在,再用昇腾部署一遍,看看速度能不能更快。p.s. 类似的内容其实已经写了很多遍了。但感觉之前写得都太碎,不够顺畅。接着新模型写篇长文,把能包括的都包括进来。这样大家也不需要到处翻来翻去。

xiezhipu的博客 2450

UVa11722

11722 Joining with FriendYou are going from Dhaka to Chittagong by train and you came to know one of your old friends is goingfrom city Chittagong to Sylhet. You also know that both the trains will ha...

weixin_30492047的博客 165

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

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

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

uva11722(概率)

题意: 两个人到达车站的时间分别是t1-t2, s1-s2;并且到站后停留w分钟.问相遇的概率; 思路: 高中数学学过这个问题;首先是x轴取t1, t2,y轴取s1,s2画四条线,围出的矩形就是全集,即所有可能行; 然后两个人要相遇,则到站时间只能相差w以内; 所以画两条直线y = x + w ; y = x - w; 两条直线在之前的矩形中,夹在中间的面积,就是相遇的可能;

潜水的程序猿 1196

IMSL CNL 7.0.0 (x86-64)Crack

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

uva 11722

题意:你和朋友都要乘坐火车,并且都会途径A城市。你们很想会面,但是你们到达这个城市的准确时刻都无法确定。你会在时间区间[t1,t2]中的任意时刻以相同的概率密度到达。你的朋友则会在时间区间[s1,s2]的任意时刻以相同的概率密度到达。你们的火车都会在A城市停留w分钟。只有在同一,你们所在的火车都停在A城市的时候,才可能会面。你的任务是计算出现这种情况的概率。 #include <i...

weixin_30487317的博客 137

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

UVA 11722 Joining with Friend 图形面积+概率

#include #include using namespace std; int main() { int T,tt=0; scanf("%d",&T); while(T--) { int a[10],t1,t2,s1,s2,w,i,j,k,p,x,y; double s=0,sum;//s记录非阴影面积 sc

冷月之殇 1824

UVA11722(见面概率)

题意:       有一个车站,两个人想要在这个车站见面,第一个人会在t1到t2之间的任意一个时刻到(时间上任意一点概率一样),并且停留w时间,第二个人是s2到s2的时间段到,停留也是w,问两个人的见面概率是多少? 思路:       这个应该算是个比较经典的问题了吧,感觉在那看到过,我们建立一个直角坐标系,t1 #include #include

天使也掉毛 775

uva11722——直线与矩形相交

题目链接:https://vjudge.net/contest/325833#problem/M Sidney以相同的概率密度在[t1,t2]到达不高山;Gandtom也以相同的概率密度在[s1,s2]到达。每个人都会停留W时间,问发生事情的概率。/捂脸 Input 第一行组数T(T < 500)。 接下来T行每行包含五个整数t1,t2,s1,s2,w(360≤t1 <t2 &l...

mumei的博客 1403

Uva11722 Joining with Friend

题目大意:你和朋友都要乘坐火车,并且都会途径A城市。你们很想会面,但是你们到达这个城市的准确时刻都无法确定。你会在时间区间[t1,t2]的任意时刻以相同的概率密度到达。你朋友则会在时间区间[s1,s2]内的任意时刻以相同的概率密度到达。你们的火车都会在A城市停留w分钟。只有在同一时刻,你们所在的火车都停在城市A的时候,才有可能会面。你的任务是计算出现这种情况的概率。 题目分析:假设x和y

WKLL_ 982
上一篇: hdu4336Card Collector_概率dp
下一篇: UVA11762 Race to 1
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值