Codeforces Round #105 (Div. 2) B. Escape

Codeforces Round #694 (Div. 1 + Div2)(A ~ H,8题全,超高质量题解)【每日亿题】2021/2/1、2/2 寒假每日训练2021/1/21 每日亿题 这套Div2 好简单呀,我写了不到两个小时就快AK了… 阅读详情

B. Escape
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

The princess is going to escape the dragon's cave, and she needs to plan it carefully.

The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hours and will chase the princess immediately. Looks like there's no chance to success, but the princess noticed that the dragon is very greedy and not too smart. To delay him, the princess decides to borrow a couple of bijous from his treasury. Once the dragon overtakes the princess, she will drop one bijou to distract him. In this case he will stop, pick up the item, return to the cave and spend f hours to straighten the things out in the treasury. Only after this will he resume the chase again from the very beginning.

The princess is going to run on the straight. The distance between the cave and the king's castle she's aiming for is c miles. How many bijous will she need to take from the treasury to be able to reach the castle? If the dragon overtakes the princess at exactly the same moment she has reached the castle, we assume that she reached the castle before the dragon reached her, and doesn't need an extra bijou to hold him off.

Input

The input data contains integers vp, vd, t, f and c, one per line (1 ≤ vp, vd ≤ 100, 1 ≤ t, f ≤ 10, 1 ≤ c ≤ 1000).

Output

Output the minimal number of bijous required for the escape to succeed.

Sample test(s)
Input
1
2
1
1
10
Output
2
Input
1
2
1
1
8
Output
1
Note

In the first case one hour after the escape the dragon will discover it, and the princess will be 1 mile away from the cave. In two hours the dragon will overtake the princess 2 miles away from the cave, and she will need to drop the first bijou. Return to the cave and fixing the treasury will take the dragon two more hours; meanwhile the princess will be 4 miles away from the cave. Next time the dragon will overtake the princess 8 miles away from the cave, and she will need the second bijou, but after this she will reach the castle without any further trouble.

The second case is similar to the first one, but the second time the dragon overtakes the princess when she has reached the castle, and she won't need the second bijou.


题目链接:http://codeforces.com/problemset/problem/148/B


题目大意:已知公主逃跑的速度vp和龙的速度vd,公主从龙穴逃跑 t 小时后龙发现并追赶公主,公主要到达距离龙穴 c 米处的目的C地才安全。在龙追赶公主的过程中,如果公主使用一颗钻石,那么该钻石能使龙返回到洞穴并在洞穴中停留 f 小时。求公主到达目的地最少使用多少颗钻石。


解题思路:过程模拟。在龙追上公主的一刻使用钻石。注意如果公主和龙同时到达目的地时不必再使用钻石。


代码如下:

#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
const int maxn=1005;
int main(void)
{
	double vp,vd,t,f,c,s;
	int ans=0;
	scanf("%lf%lf%lf%lf%lf",&vp,&vd,&t,&f,&c);
	if(vp>vd)
	{
		printf("0\n");
		return 0;
	}
	s=t*vp*vd/(vd-vp);   //龙第一次追上公主是距龙洞的距离
	while(s<c)           //如果追上但还没到达目的地
	{
		ans++;            //使用一颗钻石
		t=s/vd+f;         //龙返回洞穴和停留的时间
		s+=t*vp;          //这段时间后公主距龙洞的距离
		s=s*vd/(vd-vp);   //再次追上时的距龙洞的距离
	}	
	printf("%d\n",ans);
}


Xilinx Vitis arm-xilinx-eabi-gcc.exe: error: *.c: Invalid argument This problem may be a bugof version 2021.1 only. Unfortunately, I'm just currently using this version. After Build Project: Find where this Makefile is through "make: Leaving directory" information. For me, it is located atZynq_CPU_wrapper_hw_platfo... 阅读详情

相关推荐

Hive数据迁移

【迁移背景】 本次需要将老集群的hive数据(共30多张表)迁移至新集群中。 老集群版本为CDH5.13,未启用kerberos; 新集群版本为CDH5.14,启用了kerberos。 由于cloudera官方文档说明,在5.x的版本不支持从未启用kerberos的集群与启用了kerberos的集群之间的数据复制。因此无法通过bdr方式进行数据同步。于是采用手工方式进行测试验证。 第一步...

wangkuangood3200的专栏 472

Codeforces B. Escape

题意:公主以vp的速度逃跑,龙以vd的速度去追赶,公主出发t时间后龙才出发,如果龙追上了公主,公主便使用个道具是龙以原速度回到出发点,并且f时间后才可以出发。公主与终点距离c,只要公主到达终点龙就追不上公主,问公主需要使用多少次道具。 思路:如果龙的速度小于公主的速度就永远追不上,只需要计算每次龙追上公主的时间即可。再将距离和终点比较。具体看代码。 #include&lt;cstdio&gt...

JTY的博客 376

循环卷积和线性卷积(矩阵视角)

矩阵视角的循环卷积核线性卷积

shengsong 3587

水题 Codeforces Round #105 (Div. 2) B. Escape

题目传送门 1 /* 2 水题:这题唯一要注意的是要用double,princess可能在一个小时之内被dragon赶上 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <cmath> 8 ...

weixin_34380781的博客 96

深入解析SerDes系统中的时钟数据恢复电路(CDR)——基于Cadence的PLL/Bang-Bang/PS-PI架构实现与仿真

本文深入解析SerDes系统中的时钟数据恢复电路(CDR),重点探讨基于Cadence平台的PLL、Bang-Bang和PS-PI三种架构的实现与仿真。通过详细的技术对比和工程实践案例,揭示CDR在高速串行通信中的关键作用,并提供TSMC 28nm工艺下的优化策略与故障排查经验,助力工程师应对10Gbps以上SerDes设计挑战。

weixin_29202687的博客 263

【硬件】通俗易懂的讲解晶体管(三极管和MOS管)的工作原理

晶体管是一个简单的元器件,可用于构建许多有趣的项目。在本文中,我将用通俗易懂的语言给您讲解晶体管的工作原理,以便您可以在电路设计中更好的使用静态管。一旦你学习这些基础知识,对以后的设计和使用来说,将会变得非常容易。我们将重点介绍两种最常见的晶体管:双极型晶体管(三极管)和MOSFET。晶体管的工作原理其实是类似于电子开关。它可以打开和关闭电路。一个简单的思考方法是将晶体管视为无源的继电器。晶体管类似于继电器,从某种意义上说,您可以使用它来打开和关闭某些东西。但晶体管也可以部分导通,一般在放大电路中使用,这部

1万+

Codeforces Round #632 (Div. 2) B.Kind Anton

Codeforces Round #632 (Div. 2) B.Kind Anton 题目链接 Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem: There are two arrays of integers a ...

旺崽的博客 2513

Verilog——反相器

反相器代码: module inv( A, Y );//A,Y是端口 //定义端口属性 input A; output Y; //定义输入输出关系 assign Y=~A;//Y等于A的反 endmodule //inv是module的名字

weixin_41788560的博客 9504

Codeforces Round #619 (Div. 2) B.Motarack's Birthday

Codeforces Round #619 (Div. 2) B.Motarack’s Birthday Dark is going to attend Motarack’s birthday. Dark decided that the gift he is going to give to Motarack is an array a of n non-negative integers. D...

旺崽的博客 3111

深入理解「二进制掩码」:从原理到实践

二进制掩码本质上是一个二进制数,用于通过位操作(如与、或、非、异或等)选择性地操作目标数据的某些位。掩码的每一位(bit)可以看作一个“开关”,决定是否对目标数据的对应位进行操作。二进制掩码是位操作的灵魂,掌握它不仅能提升代码效率,还能解锁许多高级编程技巧。从基础的位提取到复杂的子集枚举,掩码的应用无处不在。希望本文的讲解和代码示例能帮助你快速上手,并在实际项目中灵活运用。如果你有更多关于掩码的疑问或应用场景,欢迎在评论区留言交流!

m0_73494933的博客 2439

将GroundDINO、EdgeMTAM和FoundationPose的ONNX模型转换为TensorRT格式并部署到NVIDIA Jetson Orin平台的完整技术指南

TensorRT模型部署指南:从ONNX到Jetson Orin的优化实践 本文详细介绍了将GroundDINO、EdgeMTAM和FoundationPose模型从ONNX格式转换为TensorRT引擎并在Jetson Orin平台部署的全流程。主要内容包括: 环境配置:JetPack 5.1.2+环境搭建,TensorRT工具链安装,存储与交换空间优化 模型转换:动态尺寸处理、自定义算子实现、层融合策略及INT8量化校准 部署优化:引擎序列化加密、多模型并行推理架构设计、CUDA流异步执行 实战技巧。

huanghm88的专栏 443

Codeforces Round #614 (Div. 2) B.JOE is on TV!

Codeforces Round #614 (Div. 2) B.JOE is on TV! Our dear Cafe’s owner, JOE Miller, will soon take part in a new game TV-show “1 vs. n”! The game goes in rounds, where in each round the host asks JOE an...

旺崽的博客 3069

3、利用预训练卷积神经网络进行特征提取

本文介绍了如何使用预训练的卷积神经网络(如VGG16)进行图像特征提取,并将提取的特征存储在HDF5数据集中,以便后续用于机器学习模型的训练。文章详细阐述了特征提取的原理、HDF5数据格式的优势、HDF5DatasetWriter类的实现、特征提取流程的代码实现以及实际应用案例。通过该方法,可以在多种图像数据集上高效构建高精度的分类模型。

z2a3b4c5d的博客 124

Codeforces Round #306 (Div. 2)

题目传送:Codeforces Round #306 (Div. 2) 这次打的很差,有点累,先贴个代码吧。。 A - Two Substrings #include #include #include #include #include #include #include #include #include #include #include #i

Never say never 850

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【codeforces】Codeforces Round #277 (Div. 2) 题解

传送门:Codeforces Round #277 (Div. 2)

poursoul 1411

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Codeforces Round #687(Div2)A~D题题解

A. Prison Break 题目传送门: A. Prison Break 题目大意: 有一个n*m的监狱,每一个格子有一个犯人,坐标为( r , c )的格子有一条逃生通道,犯人每一秒可以向相邻的一个格子移动,问所有犯人到达逃生通道最久需要多少秒。 思路: 判断监狱四个角上的犯人到达逃生通道的时间即可 AC Code #include<bits/stdc++.h> using namespace std; int main() { int t; scanf("%d",&amp

稚始稚终的博客 2692

Codeforces Round #696 (Div. 2)(A~D题解)

Codeforces Round #696 (Div. 2)(A~C题解) ——南昌理工学院ACM集训队 题目链接:https://codeforces.ml/contest/1474 A. Puzzle From the Future In the 2022 year, Mike found two binary integers a and b of length n (both of them are written only by digits 0 and 1) that can have lead

jiushu_LQ的博客 3539

Codeforces Round #706 (Div. 2)-B. Max and Mex-题解

目录Codeforces Round #706 (Div. 2)-B. Max and MexProblem DescriptionInputOutputSample InputSample OnputNote题目大意题目分析MEX≥\ge≥n其实就是MEX=nMEX≤\le≤n解题思路AC代码 Codeforces Round #706 (Div. 2)-B. Max and Mex 传送门 Time Limit: 1 second Memory Limit: 256 megabytes Problem

<font color="Pink">Tisfy的博客</font> 1万+

Codeforces Round #532 (Div. 2)

Contests 链接:Codeforces Round #532 (Div. 2) A. Roman and Browser 题意 RomanRomanRoman 最开始打开了 nnn 个网页,所有网页要么是个测试网页,要么是一个社交网页,现在他打算每隔 kkk 个网页就关闭一个网页,要使得这两种网页的差的绝对值最大,求最大值。 输入 第一行为两个整数 n,k&amp;amp;nbsp;(2≤k&amp;amp;amp;...

Dmaxiya 1227

Codeforces Round #713 (Div. 3)-C. A-B Palindrome-题解

目录Codeforces Round #713 (Div. 3)-C. A-B PalindromeProblem DescriptionInputOutputSample InputSample Onput题目大意解题思路AC代码 Codeforces Round #713 (Div. 3)-C. A-B Palindrome 传送门 Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description You are given a

<font color="Pink">Tisfy的博客</font> 1万+

Codeforces Round #612 (Div. 2)

Codeforces Round #612 (Div. 2) B题: 题意:一横排是一张牌,如果满足任意三张牌可以组成的每一列有三张相同的牌或者有三张不同的牌就可以组成一副牌,问能组成多少副这样的牌,打乱顺序算一副。 题解:我们通过两张牌来匹配第三章牌的方式来确定。 #include<bits/stdc++.h> using namespace std; const int N=1e3...

行走天涯的豆沙包的博客 723

Codeforces Round #604 (Div.2)

Codeforces Round #604 (Div.2) 2019/12/5 22:35——2019/12/6 00:35 这是我经历了多次掉分之后的第一次上分,是个好兆头。虽然只有区区16分,但是见到情况有些好转,看到这么多天的努力没有白费,心里感觉还是很开心呢。 Codeforces Round #604 (Div.2) A. Beautiful String time ...

qq_30445397的博客 664

Codeforces Round #707 (Div. 2)

比赛传送门: Codeforces Round #707 (Div. 2) A. Alexey and Train 思路: 按题意模拟即可 AC Code #include<bits/stdc++.h> using namespace std; int a[105],b[105],t[105]; int main() { int d; scanf("%d",&d); while(d--) { int n; scanf("%d",&n); for(int i=1

稚始稚终的博客 1408

Codeforces Round #638 (Div. 2) C.Phoenix and Distribution

Codeforces Round #638 (Div. 2) C.Phoenix and Distribution 题目链接 Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strin...

旺崽的博客 2704

【 Codeforces Round #596 [Div. 2] D. Power Products】

【 Codeforces Round #596 [Div. 2] D. Power Products】 Description You are given n positive integers a1,…,an, and an integer k≥2. Count the number of pairs i,j such that 1≤i<j≤n, and there exists an i...

来日浅谈的博客 2313
上一篇: ZOJ 3813 Pretty Poem (暴力)
下一篇: UVA onlinejudge 11401 - Triangle Counting
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值