poj 1905Expanding Rods(二分法)(解题报告)

深入Linux内核:PTP硬件时间戳(HW Timestamp)是如何炼成的? 本文深入探讨了Linux内核中PTP硬件时间戳(HW Timestamp)的实现原理与实战应用。通过分析IEEE 1588协议在网络时间同步中的关键作用,详细解析了硬件时间戳在Linux内核中的架构设计、驱动开发及性能优化技巧,帮助开发者实现纳秒级精度的时间同步。 阅读详情

链接:http://poj.org/problem?id=1905

Expanding Rods

Description

When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion.
When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being the chord of the segment.

Your task is to compute the distance by which the center of the rod is displaced.

When a thin rod of length L is heated n 


Input

The input contains multiple lines. Each line of input contains three non-negative numbers: the initial lenth of the rod in millimeters, the temperature change in degrees and the coefficient of heat expansion of the material. Input data guarantee that no rod expands by more than one half of its original length. The last line of input contains three negative numbers and it should not be processed.

Output

For each line of input, output one line with the displacement of the center of the rod in millimeters with 3 digits of precision.

Sample Input

1000 100 0.0001

15000 10 0.00006

10 0 0.001

-1 -1 -1

Sample Output

61.329

225.020

0.000

Source

思路:数学推论+二分查找

// 设 r为半径,&为角度 ,d为所求目标,L2=&r,sin(&/2)=L1/ (2.0*r),cos(&/2)=(r-d)/(r);

//且(cos&^2+sin&^2=1)则 r=(4*d*d+L1*L1)/(8*d), l=2*asin(l/(2.0*r))*r;比较l与L2的大小即可 


#include<stdio.h>
#include<math.h>
int main()
{
    double L1,n,c;
    double r,l,d,high,low,mid,L2;
    while(scanf("%lf%lf%lf",&L1,&n,&c)!=EOF&&!(l<0&&n<0&&c<0))
    {
    L2=(1+n*c)*L1;
    high=L2;
    low=0;
    //printf("%.0lf\n",L);
    while(high-low>1e-6)//利用二分法查找目标 
    {
    mid=(high+low)/2.0;
    //printf("mid=%.0lf\n",mid);
    r=(4*mid*mid+L1*L1)/(8.0*mid);
    //printf("r=%.0lf\n",r);
    l=2*asin(l/(2.0*r))*r;
   // printf("L1=%.0lf\n",L1);
    if(l<L2)
    low=mid;
    else
    high=mid;
    }
    printf("%.3lf\n",high);
}
return 0;
    }


【教程4>第7章>第6节】基于FPGA的Viterbi维特比译码verilog实现——ACS加比选单元1 本文介绍了ACS加比选单元模块在FPGA中的实现过程,重点讲解了维特比译码中的ACS单元功能及其在硬件实现中的关键问题。文章首先概述了ACS单元在维特比译码中的作用,即通过计算和比较分支度量值来选择最优路径。接着,详细描述了FPGA实现中的分支度量值归一化处理策略,并指出了其存在的弊端。随后,文章提供了基于Verilog的ACS加比选单元模块代码,解释了其输入输出端口及工作流程。最后,总结了本小节内容,并预告了下一章节将涉及ACS顶层模块的开发与仿真测试。 阅读详情

相关推荐

避开这些坑!QMT多因子策略实盘中的5个常见错误及解决方案

本文深入剖析了在QMT平台上实施多因子策略时常见的5个错误,包括因子过拟合、数据延迟处理不当、因子失效、交易成本低估和风险控制缺失,并提供了实用的解决方案。通过优化因子筛选、数据对齐和动态管理,帮助量化交易者提升策略稳健性和实盘表现。

k5l6m的博客 238

poj 1905 (Expanding Rods) 二分的运用

Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15096   Accepted: 4009 Description When a thin rod of length L is heated n degrees, it expands

obsessiveness_GHL的博客 501

【新能源汽车测试工程师必看!DBC文件50条实战技巧,看懂这篇直接封神】

如果你是新能源汽车研发/测试工程师,还在为信号解析错误、报文找不到、DBC看不懂、实车故障复现不了头疼——那这篇文章,你一定要!在整车电控开发里,DBC = CAN总线的官方字典。没有DBC,报文就是一串乱码;读不懂DBC,测试寸步难行;用不好DBC,排查故障全靠猜。本文总结50条全网最实用、最贴近实车、最能解决问题的DBC技巧,从基础语法到新能源专用信号,从工具操作到故障排错,全部来自一线台架、实车、高压平台实战经验。不废话、不空谈、不玄学,全是能直接落地的硬货!

优快云-新能源汽车研发测试专业博主 1367

POJ 1905 Expanding Rods 木棍膨胀

描述 当长度为L的一根细木棍的温度升高n度,它会膨胀到新的长度L'=(1+n*C)*L,其中C是热膨胀系数。 当一根细木棍被嵌在两堵墙之间被加热,它将膨胀形成弓形的弧,而这个弓形的弦恰好是未加热前木棍的原始位置。 你的任务是计算木棍中心的偏移距离。 输入 三个非负实数:木棍初始长度(单位:毫米),温度变化(单位:度),以及材料的热膨...

weixin_30546933的博客 374

大语言模型与ROS集成的自然语言机器人控制:开源框架与应用实例

近年来,大语言模型(LLM)与机器人操作系统(ROS)的集成逐步成熟,使得自然语言驱动的机器人控制成为可能。用户输入“捡起绿色方块”或“把微波炉里的饭热好端过来”这类日常语句,机器人能够自动拆解步骤、规划动作并执行。本文梳理2026年前后发布的三个代表性开源框架——ROS-LLM、ROSClaw以及LLM+Nav2基准测试系统,介绍其技术路径与工程落地情况。

Studying…… 633

python实现序列比对之Needleman-wunsch算法 (附完整源码)

python实现序列比对之Needleman-wunsch算法 (附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 459

POJ1905-Expanding Rods

全解题报告索引目录 -> 【北大ACM – POJ试题分类】 转载请注明出处:http://exp-blog.com ------------------------------------------------------------------------- 大致题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲 求前后两个状态的杆的中点位置的距离 解题...

ζёСяêτ - 小優YoU 5500

无刷电机里的霍尔传感器,和 AS5600 编码器到底有什么区别?

摘要: 无刷电机中的霍尔传感器主要用于换相控制,提供6种状态反馈,无法实现精确角度测量。与AS5600磁编码器(分辨率4096)相比,霍尔仅能确保电机“转得对”,而编码器则用于高精度角度反馈。在机器人等需要位置闭环的场景中,两者需协同使用:霍尔负责基础换相,编码器提供精确角度控制。简单应用中可仅用霍尔,但高精度定位必须搭配编码器。

qq_45430571的博客 242

POJ 1905 Expanding Rods(二分)

Description 下图中线段长度为L,上边圆弧长度为L’=(1+n * C) * L,问圆弧最高点到线段的距离 Input 多组用例,每组用例输入三个非负实数L,n,C,以三个负数结束输入 Output 输出圆弧最高点到线段的距离 Sample Input 1000 100 0.0001 15000 10 0.00006 10 0 0.001 -1 -1 -1 Sam

ZSQ 595

【2026年得物春招算法岗- 4月18日 -第二题- 老张爬山】(题目+思路+Java&C++&Python解析+在线测试)

这篇文章介绍了一个动态规划问题,解决老张在n天内安排爬山计划以最大化愉悦值的问题。题目允许最多k次打破"不能连续两天爬山"的规则限制。 摘要要点: 使用三维动态规划数组dp[i][j][s],表示第i天结束时已用j次机会、当天状态为s(0不爬/1爬)时的最大愉悦值 状态转移考虑两种情况:当天不爬山时取前一天两种状态的最大值;当天爬山时分别处理前一天不爬山和爬山(需消耗机会)的情况 最终结果为考虑所有可能用掉的k次机会后,最后一天两种状态的最大值 提供了Python、Java和C++三种实

m0_73659489的博客 1357

YOLOv11训练命令完全指南:从核心参数解析到高级调优实战(数据配置、epochs设定、batch-size优化与img-size调整)(二)

本文介绍了YOLOv11训练命令的完整配置与解析,提供了基础训练命令示例及参数详解。示例命令包含数据集配置(coco.yaml)、训练轮次(300)、批次大小(64)、图像尺寸(640)等核心参数,以及优化器(AdamW)、学习率(0.001)等调优选项。通过代码实现展示了训练器的初始化流程,包括参数解析、设备设置、数据加载和模型创建等关键步骤,为YOLOv11模型训练提供了实用指导。

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 1093

ACM-Expanding Rods

A -Expanding Rods Time Limit:1000MSMemory Limit:30000KB64bit IO Format:%I64d & %I64u SubmitStatus Description When a thin rod of length L is heated n degrees, it ex...

weixin_30765319的博客 204

【知识分享】单端到混合S参数转换指南

信号完整性(SI)工程师几乎总是必须使用S参数,因为许多的高速接口和行业标准都正在转向串行链路架构,并使用基于S参数测量的频域限制指标,了解其工作过程将会很有意义。

一只豌豆象的博客 1576

Expanding Rods POJ - 1905

E - Expanding Rods POJ - 1905 When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two ...

小飞猪的博客 245

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

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

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

POJ 1905 Expanding Rods

Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9197   Accepted: 2293 Description When a thin rod of length L is heated n degrees, it expands to

ACM2272902662的专栏 621

深度学习工具包 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")

POJ 1905 - Expanding Rods 【二分/三分】

题目链接:http://poj.org/problem?id=1905 题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲 求前后两个状态的杆的中点位置的距离 思路:如图所示,已知s,a 求x。设角度为rad,半径为r, 显然,我们有r = s/ rad = a/sin(rad);即a*rad-s*sin(rad)=0或者rad/sin(rad) = s/a。下面我们就根据这

Fighting! 1600

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

POJ1905-Expanding Rods - 二分法。

Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13354   Accepted: 3442 Description When a thin rod of length L is heated n degrees, it expands

there,there 403

I - Expanding Rods解题报告(黄杰)

I - Expanding Rods Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit Status Description When a thin rod of length L is heated n degrees, it expands

CSUST_ACM的专栏 3595

POJ 1905 Expanding Rods

Expanding Rods Time Limit:500MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Description When a thin rod of length L is heated n degrees, it expands to a

※夏日星空※ 255

F - Expanding Rods POJ 1905

F - Expanding RodsTime Limit:500MS Memory Limit:32768KB 64bit IO Format:%lld & %llu SubmitStatus Description When a thin rod of length L is heated n degrees, it expands to a new length L’ =

DTL66的博客 378

POJ 1905 Expanding Rods

Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 12160   Accepted: 3160 Description When a thin rod of length L is heated n degrees, it expands

ysCover 562

【POJ 1905】 Expanding Rods (二分)

【POJ 1905】 Expanding Rods 公式+二分 题意是一根棍 恰好夹在两面墙之间 在n温度下膨胀成(1+n*c)*l长度 问此时中的距原中点距离 膨胀后变成一段弧 也就是圆的一部分 原来的棍子就变成了圆的截线。。。这不是高中很常见的图么。。。 不会在电脑作图。。大家手画一下就知道了 这样做几条辅助线 从圆心做截线的垂线延长到弧 设棍子原长L 膨胀后(弧)长s 膨胀后中点与

ACMer' 1338

POJ 1905-Expanding Rods(二分+计算几何)

题目地址:POJ 1905 题意:一根某种材料做的直杆被夹在两面墙之间,当他受热时长度变长,就会因两面墙的挤压而向上隆起。长度变化函数为 L'=(1+n*C)*L,给定L,C,n,求向上拱起的高度H。 思路: 手动计算出这两个公式,然后用二分查找h值。 #include #include #include #include #include #include #includ

Rocky0429 1782

POJ 1905 Expanding Rods(二分)

Problem Description When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid wa...

wcxyky的博客 237

POJ 1905, Expanding Rods

Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 4863Accepted: 1058 DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coe...

weixin_33816611的博客 266

【二分】POJ1905[Expanding Rods]题解

POJ1905题解。

ZigZagK的博客 663
上一篇: hdu 1166 敌兵布阵 (解题报告)
下一篇: poj 2406 Power Strings(字符问题)(解题报告)
CSUST_ACM
博客等级 码龄15年 42粉丝 127原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值