CodeForces 148B - Escape

VIVADO & VITIS 报错记录 问题详情:使用BD用DMA上传少量数据,根据ILA监测到的AXI总线数据正常,VALID信号和READY信号都正常,但是在PS端的cache缓冲区示数为0,打印为0。可能是因为print和printf混用导致。解决方案:修改缓冲区的对齐参数。 阅读详情

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.



===============================


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int ans=0;
    double vp,vd,t,f,c;
    cin>>vp>>vd>>t>>f>>c;
    if(vd<=vp)
    {
        cout<<"0"<<endl;
        return 0;
    }
    double disp=t*vp;//公主开始所在位置
    disp+=disp/(vd/vp-1);//龙第一次追上公主所在位置
    while(disp<c)
    {
        ans++;//此时需要一颗珠宝
        disp+=disp/vd*vp;//龙回到洞穴这段时间里公主的位置
        disp+=f*vp;//龙鉴定珠宝时公主的位置
        disp+=disp/(vd/vp-1);//龙再次追到公主的位置
    }
    cout<<ans<<endl;
    return 0;
}



企业数据治理体系中的AI与业务融合:架构师的3个成功案例 企业数据治理的痛点从来不是“有没有做”,而是“做了之后有没有用”——很多企业花了数百万建数据仓库、做元数据管理,最后却陷入“数据躺在库里睡大觉”“AI模型因数据质量差而失效”的困境。本文通过零售、金融、制造3个真实案例,拆解架构师如何用AI连接数据治理与业务场景:从“客户画像不准”到“精准推荐提升30%转化率”,从“欺诈检测漏报”到“实时拦截减少50%损失”,从“库存积压”到“供应链周转率提升20%”。如何让数据治理从「合规驱动」转向「价值驱动」? 阅读详情

相关推荐

Verilog的综合指令

Synopsys综合指令

烟花一时的博客 5447

codeforces 105 B. Dark Assembly(birbe贿赂 noip模拟赛)

B. Dark Assembly time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dark Assembly is a governing body in the Netherwor...

weixin_34019929的博客 204

算法设计与分析 0-1背包问题 动态规划解法【超详细】

0-1背包问题 问题描述 给定i个物品和一个容量为的背包,物品的重量是Wi,其价值为Vi 物品个数为i,背包容量为C。 如何选择装入背包内的物品,使得装入背包中的物品的总价值最大? 其中,每种物品只有全部装入背包或不装入背包两种选择。 物品不能分割,不能重复使用。 动态规划算法思路 首先建立一个数组B[i][c],最上面一行表示背包容量,最左边一列表示物品编号,中间填充的数值表示当当前背包容量为C...

寒泉 4万+

codeforces 105 div2 B

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

丿聪丶 544

LK32T102 单片机 操作GPIO实现流水灯(1)

前言: LK32T10232(32位)单片机是一款专为电机控制器和数字电源开发的高性能 MCU。采Cortex-M0 内核,最高工作频率可达 72Mhz,ADC 采样速率 达 1Msps。同时具备协处理器单元可满足各种乘法、除法、移位以及各种 复杂函数运算。 LK32T102(32位)支持单电源供电,且内嵌高精度高速及低速振荡器,以及具备 多种低功耗工作模式。同时,集成了多路增强型 PWM,多通道模拟比较 器和高速运算放大器,可满足多种电机及功率控制应用,并简化系统成本。...

qq_58676187的博客 3189

星宸科技SSD20x/SSD21X应用层DEMO实战指南:从入门到深度定制

本文详细介绍了星宸科技SSD20x/SSD21X系列芯片的应用层DEMO开发实战,从基础环境搭建到深度定制开发。内容涵盖DEMO资源获取、核心功能实现、第三方库集成以及性能优化技巧,帮助开发者快速掌握智能显示和多媒体处理应用的开发方法。特别适合嵌入式开发者在智能家居、工业控制等场景中应用。

weixin_42524226的博客 267

CodeForces 148B Escape

Escape Time Limit:2000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64u SubmitStatusPracticeCodeForces 148B Description The princess is going to escape the dragon's c...

weixin_34354945的博客 181

零中频接收机实战:DC Offset的5种常见解决方案与调试技巧

本文针对零中频接收机中DC Offset这一核心挑战,深入剖析了其产生机理与对信号解调的严重影响。文章从实战角度出发,系统性地介绍了五种解决方案,包括硬件预防、数字域校正、I/Q不平衡联合校正等,并分享了关键的实验室调试与产线测试技巧,旨在帮助射频工程师有效提升接收机性能。

weixin_29234509的博客 399

Codeforces 148B: Escape

题目链接:http://codeforces.com/problemset/problem/148/B 题意:公主从龙的洞穴中逃跑,公主的速度为vp,龙的速度为vd,在公主逃跑时间t时,龙发现公主逃跑并开始追公主。公主每丢弃一块宝石,龙需要花f小时整理并送回洞穴,然后再去追公主,公主在离洞穴距离为c的时候就安全了,求公主在逃跑过程中需要丢弃的宝石数 #in...

weixin_34239592的博客 166

凝聚态物理新引擎:AI 驱动材料预测与相变识别大突破

摘要:本文深入探讨 AI 在凝聚态物理中的创新应用。在材料性质预测方面,AI 借助数据收集、特征提取和模型训练,能依据材料微观信息准确预估其宏观性质,以石墨烯为例验证了高效性。对于拓扑相变识别,AI 通过分析量子力学数据,利用机器学习算法判别相变节点,助力拓扑绝缘体研究。尽管面临数据质量、模型可解释性等挑战,但未来多模态数据融合、可解释 AI 等发展方向,将推动 AI 与凝聚态物理深度融合,助力探索物质奥秘与新材料研发。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1828

【自动驾驶轨迹规划之hybrid A*算法】

本文参考论文:https://ai.stanford.edu/~ddolgov/papers/dolgov_gpp_stair08.pdf 这篇文章是基于经典A*算法与reeds-shepp曲线的,不清楚的读者请参考【自动驾驶轨迹规划5之A*算法】_无意2121的博客-优快云博客【自动驾驶轨迹规划之dubins曲线与reeds-shepp曲线】_无意2121的博客-优快云博客 目录 1 hybrid A* 算法创新点 1.1 搜索方式 1.2 车辆运动学模型 1.3 reeds-shepp曲

weixin_65089713的博客 1万+

【CF】CodeForces 301A Yaroslav and Sequence

A. Yaroslav and Sequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Yaroslav has an array, consisting

Song 985

MoveIt 运动学、运动规划、混合规划、move_group

混合规划是运动规划方法的一个术语,它将异构运动规划器结合起来,以产生更稳健或反应更快的解决方案。这种通用方法在导航领域已经非常成熟,并在导航2等流行项目中成功实施。MoveIt 的混合规划架构结合了一对全局规划器和局部规划器,它们以不同的规划速度和问题范围并行、并发运行。全局规划器的任务是解决全局运动规划问题,这与 “感知-规划-行动 ”应用中使用的规划器非常相似。所使用的规划器算法应该是完整的,因此假定其计算时间相对较慢。此外,全局规划器不要求实时安全,这意味着无法保证规划器在特定期限内找到解决方案。

机器人控制与仿真应用 2131

CodeForces 148B Escape

F - Escape Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 148B Description The princess is going to escape the dragon

樱花满地集于我心,楪舞纷飞祈愿相随 389

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

CodeForces 148B Escape

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

Sirius_han的博客 383

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

codeforces-148B-Escape

148B-EscapeDescription

Linoy 926

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

CodeForces - 148B Escape (模拟)

题目链接:http://codeforces.com/problemset/problem/148/B点击打开链接 B. Escape time limit per test 2 seconds memory limit per test 256 megabytes input standard input out

xuejye的博客 320

CodeForces 148B Escape(模拟)

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 e...

H4ppyD0g的博客 366

codeforces 148 B Escape

又一道模拟题,把关系理清楚就好做啦

toby的博客 302

B -Escape CodeForces - 148B

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

米兰的小科比 358

【模拟】CodeForces - 148B Escape

Problem Description     输入vp,vb,t,f,c分别表示公主的速度,龙的速度,一开始公主可以走的时间,恐龙捡到财宝回去放后休息时间,起点到城堡的距离。让你求公主最少需要扔多少次财宝才能到达城堡(龙不能追上公主,否则公主就被吃掉)。 代码:按要求模拟就可以了#include<bits/stdc++.h> using namespace std; int main() {

ACMer 梁剑锋 的博客 339

CodeForces 148B Escape(数学)

#include #include #include #include using namespace std; typedef long long ll; ll ans[120]; #define sp system("pause"); int main() { double vd, vp, t, f, c; cin >> vp >> vd >> t >> f >> c; if (v

宝树啊宝树 837

CodeForces - 148B B - Escape xjb模拟

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 th

Marcus-Bao的个人主页 741

codeforces 148c

C - Terse princess  CodeForces - 148C  //根据题意构造数组 //因为有坑一直 wa //当 wow 的次数等于 0 的时候,如果 oh 的次数等于 n-1, 则无法构造该数组,因为第二个数会转化成为符合 b 的条件 //做的时候考虑不全,只考虑了 n=2 的情况 #include int c[110]; int main() { int n,a

Hanylch 343

codeforces 148D 概率DP

codeforces 148D 题意: 袋中有w只白鼠和b只黑鼠,王妃和龙轮流从袋中抓取,谁先抓到白鼠谁胜。袋中有w只白鼠和b只黑鼠,王妃和龙轮流从袋中抓取,谁先抓到白鼠谁胜。袋中有w只白鼠和b只黑鼠,王妃和龙轮流从袋中抓取,谁先抓到白鼠谁胜。 王妃先抓,然后龙抓,龙抓完后会随机逃走一直老鼠。王妃先抓,然后龙抓,龙抓完后会随机逃走一直老鼠。王妃先抓,然后龙抓,龙抓完后会随机逃走一直老鼠。 若袋中...

Welcome to csdn_PatrickStar's blog 243

CodeForces - 148B

CodeForces - 148BThe 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

素宇的博客 312
上一篇: POJ 3009 - Curling 2.0(深搜)
下一篇: CodeForces 149C - Division into Teams(贪心)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值