poj 1922 Ride to School

1227:Ride to Office 2020-12-04 1227:Ride to Office 时间限制: 1000 ms 内存限制: 65536 KB【题目描述】 起点与终点相隔4500米。现Charley需要从起点骑车到终点。但是,他有个习惯,沿途需要有人陪伴,即以相同的速度,与另外一个人一起骑。而当他遇到以更快的速度骑车的人时,他会以相应的速度跟上这个更快的人。先给定所有与Charley同路的人各自的速度与出发时间,问Charley以这种方式跟人,骑完4500米需要多少时间。得出的结果若是小数,则向上取整。【输入】 输入若干组数据,每组数据... 阅读详情

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

int main()
{
    int n;
    int a,b;
    while(cin >> n)
    {
        int ans = 999999;
        int s = 0;
        if(n == 0)
        {
            break;
        }
        for(int i = 1; i<= n; i++)
        {
            cin >> a >>b;
            if(b >= 0)
            {
                double aa = (4500/(a*10.0/36.0));
                if(aa - (int)aa > 0.0)
                aa++;
                s = aa + b;
                if(s < ans)
                ans = s;
            }

        }
         printf("%d\n",ans);
    }
    return 0;
}

题目意思:从A地开始,当刚到A地时,如果有车就跟着出发,不然就等车来,再跟着。如果途中有比当前行驶速度大的车,就跟着那辆。求到B的时间。

分析:

如果时间T 〈 0,则表明主人公到之前,那个人已经到了,所以这样的情况可以忽略

接下来就是T>=0的了,我们可以这样想:如果如果主人公刚开始搭a车.b车.c.d.,最后搭上的那辆车肯定是该车全程用时最少的,那我们就可以做了,全程时间=全程距离/速度+Ti;比较一下,谁用时最少就可以了。

 

 

“开宝五子棋陪练”-首款开放智能的五子棋习题练习安卓应用 使用Kotlin语言以及Jetpack Compose UI库开发,主要就是写Composable函数,显示棋盘、棋子和一些按钮,响应用户的点击和滑动操作,以及保存和恢复数据。但我针对本应用是用于做题的特殊需求,对该算法库做了一个简单的JNI层封装,方便UI前端Kotlin代码的调用。 阅读详情

相关推荐

告别付费!手把手教你用DataV.GeoAtlas获取全国街道级GeoJSON数据(附完整避坑指南)

本文详细介绍了如何免费使用阿里云DataV.GeoAtlas工具获取全国街道级GeoJSON数据。通过可视化选取、格式转换、数据校验等步骤,提供了一套完整的避坑指南和工作流,帮助前端和可视化开发者高效解决高精度地图数据获取难题,节省成本并提升开发效率。

weixin_29085865的博客 899

信息学奥赛一本通 1227:Ride to Office | OpenJudge NOI 4.6 2404:Ride to Office

【题目链接】 ybt 1227:Ride to Office OpenJudge NOI 4.6 2404:Ride to Office 原题是英文题,虽说两题题意相同,但一本通网站没有对该问题进行直译,名字都不一样。而且描述不够完整。我在这里再翻译一下。 【题目翻译】 骑车上班 描述 许多员工住在一个叫做M小区的地方,距离他们的单位很远(4.5公里)。由于交通堵塞,许多员工选择骑车。 我们可以假设除了魏威以外所有员工都以恒定的速度从家骑到单位。魏威这个人有不同的骑车习惯——他总是试图跟着其他骑车的人而不是

君义NOIP的博客 2771

从原理到接法全面了解三相电

从原理到接法全面了解三相电

viixin的博客 1万+

信息学奥赛一本通:1227:Ride to Office

信息学奥赛一本通:1227:Ride to Office

ffsdfg的博客 792

利用PLECS实现Boost变换器的闭环控制仿真与优化

本文详细介绍了如何利用PLECS仿真软件实现Boost变换器的闭环控制与优化。从基础原理到开环系统搭建,再到闭环控制设计与动态优化,提供了完整的仿真实践指南。通过PLECS的仿真功能,工程师可以有效诊断问题、优化参数,并实现高性能的DC-DC变换器设计。

weixin_42527401的博客 325

PaddleOCR训练自己的数据

一 、数据准备 采用PPOCRLabel标注自己的数据 PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,内置PP-OCR模型对数据自动标注和重新识别。使用Python3和PyQT5编写,支持矩形框标注和四点标注模式,导出格式可直接用于PaddleOCR检测和识别模型的训练。 1.1 安装PaddlePaddle pip3 install --upgrade pip # 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装 python3 -m pip in.

zyb的博客 1万+

1227:Ride to Office

【题目描述】 起点与终点相隔4500米。现Charley需要从起点骑车到终点。但是,他有个习惯,沿途需要有人陪伴,即以相同的速度,与另外一个人一起骑。而当他遇到以更快的速度骑车的人时,他会以相应的速度跟上这个更快的人。先给定所有与Charley同路的人各自的速度与出发时间,问Charley以这种方式跟人,骑完4500米需要多少时间。得出的结果若是小数,则向上取整。 【输入】 输入若干组数据,...

C_Dreamy的博客 1057

FPGA上的时间数字转换器(TDC):详细概述及FPGA开发

本文对基于FPGA的时间数字转换器(TDC)进行了详细的概述,并提供了一个简单的示例代码,展示了如何在FPGA上实现TDC功能。在本文中,我们将详细概述基于FPGA的TDC,并提供相应的源代码示例,以帮助读者理解和实现这一功能。需要注意的是,这只是一个简单的示例,实际的TDC设计可能需要更多的功能和优化,以满足特定的需求。读取和重置:最后,测量结果可以通过读取计数器的值来获取,并且在每次读取后需要将计数器重置为零,以便进行下一次测量。TDC的基本原理是测量信号的到达时间与参考时钟之间的时间差。

EsqpWeller的博客 6868

信息奥赛一本通:1227:Ride to Office

本题是一道贪心算法解决的题目,这道题中需要我们给出最短到达目的地的时间,这个题中,人物每当遇到比自身快的人就会以相同的速度骑行。对于出发时间小于0的,如果速度比任务快,根本追不上,人物的速度与其无关,如果人物的速度比其快,那么人物的速度仍然保持,所以出发时间小于0的可以不用考虑。对于出发时间大于0的,也就是出发时间比人物慢,如果他比人物先到终点,就会相遇。人物的速度就会随之改变,两人并驾齐驱,到达终点,所以我们只需要找到所有出发时间大于0中,到达时间最短的即可。

2401_88475903的博客 607

AI编程工具深度对比:Cursor、Copilot、Trae与Claude Code,2025年开发者该如何选择?

2025年AI编程工具市场已形成四大主力阵营:Cursor(AI原生IDE)、GitHub Copilot(行业标准)、Trae(中国免费方案)和Claude Code(终端交互)。核心差异体现在技术能力(代码生成准确率85%-95%)、智能体协作程度和上下文处理能力(8K-200K tokens)。用户体验方面,Trae对中文支持最佳且免费,Copilot企业集成强,Cursor平衡易用与功能,Claude Code适合高阶开发者。实际测试显示,不同工具在原型开发、算法实现等场景各有优势

fudaihb的博客 6496

YOLOv11的扩散模型去噪预处理-(在推理前对低质量图像进行增强)

摘要: 扩散模型与YOLOv11的结合有效提升了复杂场景下的目标检测性能。针对低质量图像(如噪声、低光照)导致YOLOv11特征提取退化的问题,研究提出了一种基于条件扩散模型的预处理方法。通过语义引导的渐进式去噪,在保留关键检测特征的同时,显著改善了图像质量。技术核心包括:1)利用YOLOv11浅层特征作为条件输入;2)交叉注意力机制实现任务感知去噪;3)知识蒸馏与潜空间扩散加速推理。实验表明,该方法使mAP50提升19%,在15步内达到传统百步去噪效果,平衡了精度与实时性需求,为鲁棒性目标检测提供了新思路

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

POJ 1922 Ride to School

POJ 1922 Ride to School 1. 简单题,根据题意,这个人总是坐着最先到达的自行车到达,因此只需要算出最先到达的自行车的时间即可。 2. 值得注意的是出发时间小于0的,这个人不可能坐上这辆车。 #include <ios...

dayong9372的博客 160

基于Lumerical的1550 nm InGaAs/InP与InGaAs/InAlAs APD设计与功率饱和度优化

摘要 本研究利用Ansys Lumerical软件对1550 nm激光雷达应用的InGaAs/InP和InGaAs/InAlAs雪崩光电二极管(APD)进行仿真设计与优化。通过FDTD光学仿真获取光吸收分布,结合CHARGE模块的电学仿真分析暗电流、光电流及雪崩增益特性。重点研究了两种材料体系的性能差异,并针对近距离强反射导致的功率饱和问题提出结构优化方案。仿真结果表明,InGaAs/InAlAs APD具有更优的过量噪声特性,而优化的电荷层设计可显著提升器件的功率饱和阈值。研究提供了完整的仿真流程与代码实

huanghm88的专栏 95

POJ 1922 Ride to School 解

这道题是小学级别的题目,不知道为什么https://web.stanford.edu/class/cs97si/assn1.html这里把它的难度标为5(和POJ1001这道有点麻烦的题难度相同),可能因为老外数学太差? 题目 http://poj.org/problem?id=1922 答案 using namespace std; int main() { int n, v, t, ...

ZZXN的博客 249

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

深度学习工具包 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 1922 Ride to School 解题报告

题目传送门:http://poj.org/problem?id=1922 问题描述:   北京大学的许多研究生住在万柳校区,距离主校区燕园有4.5公里。住在万柳的同学或者乘坐巴士,或者骑自行车去主校区上课。由于北京糟糕的交通,许多同学选择骑自行车。   我们假定除了Charley以外,所有的同学从万柳到燕园都是以某一确定的速度骑自行车。Charley则有一个不同的骑车习惯———他总是要跟在另

EnCaL 1084

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

POJ——1922 Ride to School

Ride to School Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 20255   Accepted: 8179 Description Many graduate students of Peking University are living in W

逝水流年轻染尘 572

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

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

POJ1922 Ride to School

原谅我一开始没做出来…… 后来某大神告诉我,只要算出来

丛九九小朋友的NC博客 696

POJ 1922 Ride to school

Many graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus - Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to sc...

Nerdant 437

POJ1922-Ride to School

http://poj.org/problem?id=1922 注意精度问题然后向上取整,水题。 #include<stdio.h> #include<math.h> int main(void) { int N,i,v,t; double x,min; while(scanf("%d",&N),N) { ...

weixin_30762087的博客 109

POJ1922 Ride to School

题目链接:http://poj.org/problem?id=1922 解题思路: 简单的数学题。不用考虑中间的相遇过程,因为相遇了,前面的时间过了就是过了,所以直接看谁先到达学校用的时间最短就行了。 AC代码: #include #include #include #define INF 0xfffffff using namespace std; int main()

piaocoder 473

POJ 1922:Ride to School 【水】

Ride to School Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 20573   Accepted: 8306 Description Many graduate students of Peking University are living in W

所谓梦想,就是永不停息的疯狂。。。。。 1289

POJ 1922 - Ride to School

题目连接: POJ - 1922 题目概况: 起点与终点相距 4.5 km 查理在骑车上学途中喜欢跟在别人之后 当有其他人骑车速度超过查理跟的人时,查理会跟上骑得更快的那个人 最终计算查理到校的时间 最终结果向上取整(即 10.1 取 11 ) 题目解析: 最开始时想,计算查理每段跟车的时间,距离等,但是这样来回折腾换人,并不好计算。 事实上,计算查理到校的时间,其实就是计算被跟车人到校的时间。 因为如果你一开始跟在一个比较慢的人后面,骑到一半最优解的人出现了,查理肯定继续跟在最优解一直到学校了。那么这

神奇海螺的博客咯 241

POJ 1922 Ride to School 题解

POJ 1922题解

DarkoDu的博客 705

POJ 1922 Ride to School 贪心

题目链接:题目传送门 思路: 因为骑手永远是跟着其他的骑手的,所以最后一定是和其中一个一起到达,而且是第一个到达的(如果出发时间为负,显然不会是跟骑的人最后跟的车,如果这辆车更快,跟骑的人根本不可能遇到它,如果它更慢,即使跟骑的人遇到也不会换车。出发时间为正,一定会被跟骑得人跟上速度较快的) 代码: ...

艾 413
上一篇: poj 1328 Radar Installation
下一篇: poj 1017 Packets
i丹明扬
博客等级 码龄15年 331粉丝 115原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值