当前位置:网站首页>2019 Hangdian multi school first 6581 vacation [thinking]
2019 Hangdian multi school first 6581 vacation [thinking]
2022-07-24 19:34:00 【Cold instant noodles】
2019 Hangzhou Electric Power Co., Ltd The first scene 6581-Vacation【 thinking 】
subject :http://acm.hdu.edu.cn/showproblem.php?pid=6581
Reference material :
https://www.cnblogs.com/wawcac-blog/p/11229277.html
https://www.cnblogs.com/Satan666/p/11273615.html
General meaning :
share n+1 Vehicles ,0 Car number one is our car , other [1,n] Car No. 1 is the one in front of us , All in one lane , The lane width can only accommodate one car , There is a line on the far right , When the front of our vehicle reaches this line, it is counted as passing , Ask us how long it will take us to get to this line at least . The title will give the starting time of each car , The distance from this line s , Maximum speed v, The length of the body l , Each car can drive close to the bottom of the car in front at most , Not more than .
Ideas :
Read a sentence from someone else's blog, which is very good :
Squeeze all the cars together , Become a train with different carriages , Then we drive our own car , Push the train forward , Until our car reached the traffic lights ( The goal is ), Then calculate the time it takes for each car to reach its current position at its highest speed , Take the longest one in all cars ( It will get stuck in the back ).
Code :
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5+5;
int l[maxn], s[maxn], v[maxn];
double t[maxn];
int main() {
int n;
ll sum = 0;
while(~scanf("%d",&n)) {
for(int i = 0; i < n+1; i++) {
scanf("%d",&l[i]);
sum += l[i];
}
sum -= l[0];
for(int i = 0; i < n+1; i++)
scanf("%d",&s[i]);
for(int i = 0; i < n+1; i++)
scanf("%d",&v[i]);
double mymax = (s[n] + sum) *1.0 / v[n]*1.0;
for(int i = n; i >= 0; i--) {
int temp = s[i] + sum;
t[i] = temp*1.0 / v[i];
sum -= l[i];
if(t[i] > mymax) {
mymax = t[i];
}
}
printf("%.10lf\n",mymax);
mymax = 0;
sum = 0;
}
return 0;
}
边栏推荐
- Install SSL Certificate in Litespeed web server
- PostgreSQL Elementary / intermediate / advanced certification examination (7.16) passed the candidates' publicity
- MySQL sort. Sort by field value
- 纯C实现----------尼科彻斯定理
- Pay close attention! List of the latest agenda of 2022 open atom open source Summit
- Oneinstack installation and configuration PHP 8.1 and MySQL 8.0-oneinstack site building novice tutorial
- PostgreSQL weekly news - July 13, 2022
- He has been in charge of the British Society of engineering and technology for 13 years, and van nugget officially retired
- Colon sorting code implementation
- First knowledge database
猜你喜欢

PostgreSQL weekly news - July 13, 2022

Use of paging assistant PageHelper
![[question 39] special question for Niuke in-depth learning](/img/18/0e182f2c003ff5dd8ed3751c718d73.png)
[question 39] special question for Niuke in-depth learning

Techempower web framework performance test 21st round results release --asp Net core continue to move forward

How to use the interface control telerik UI for WinForms development step progress bar?

PostgreSQL Elementary / intermediate / advanced certification examination (7.16) passed the candidates' publicity

How to encrypt your own program with dongle

Database index: index is not a panacea
![[resolved] CVC datatype valid. 1.2.1: '' is not a valid value for 'ncname'.](/img/27/ae15e553eba99acf19beb93a3e9939.jpg)
[resolved] CVC datatype valid. 1.2.1: '' is not a valid value for 'ncname'.

MySQL1
随机推荐
MySQL index principle and query optimization "suggestions collection"
asp. Net core, C # summary about path
Sword finger offer 48. the longest substring without repeated characters
How to export map files tutorial
Database index: index is not a panacea
Hidden Markov model HMM
Profile environment switching
Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]
Day 4 (item 1: household income and expenditure records)
Feature extraction tool transformer Bert
About the largeheap attribute
On July 31, 2022, the dama-cdga/cdgp data governance certification class was opened!
Tencent Browser service TBS usage
信道状态信息(CSI)共轭相乘去噪法
Analysis of the basic concept of digital warehouse
从服务器批量下载文件到本地
Interface component devaxpress asp Net v22.1 - new office 365 dark theme
Hold the C pointer
Pyhanlp installation tutorial
Machine learning_ Softmax function (multi classification problem)