UVA 573 - The Snail(数学)

STM32H7+LAN8720A之ETH与LWIP配置问题(End) 开篇介绍 由于项目中需要使用到STM32H7系列的芯片,且该系列无法移植ST的标准库,只能使用ST的HAL库,通过STM32Cube生成HAL库的基本代码。在项目开发中需要使用到STM32板载的ETH口,在简化的四层模型中充当着数据链路层的角色,我们只需添加PHY并配置好IP,即可实现基本的TCP主从机通信、UDP通信等等。 一、激光雷达3i-T1 由于使用了一款只具有网口通信的单线激光雷达,其具有TCP和UDP方式的通信方式,为了避免进行TCP中的socket报文解析和繁琐的通信握手过程,我们首先将雷达配 阅读详情

The Snail 

A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on each successive day the snail climbs 10% $\times$ 3 = 0.3 feet less than it did the previous day. (The distance lost to fatigue is always 10% of the first day's climbing distance.) On what day does the snail leave the well, i.e., what is the first day during which the snail's height exceeds 6 feet? (A day consists of a period of sunlight followed by a period of darkness.) As you can see from the following table, the snail leaves the well during the third day.

DayInitial HeightDistance ClimbedHeight After ClimbingHeight After Sliding
10'3'3'2'
22'2.7'4.7'3.7'
33.7'2.4'6.1'-

Your job is to solve this problem in general. Depending on the parameters of the problem, the snail will eventually either leave the well or slide back to the bottom of the well. (In other words, the snail's height will exceed the height of the well or become negative.) You must find out which happens first and on what day.

Input 

The input file contains one or more test cases, each on a line by itself. Each line contains four integers H, U, D, and F, separated by a single space. If H = 0 it signals the end of the input; otherwise, all four numbers will be between 1 and 100, inclusive. H is the height of the well in feet, U is the distance in feet that the snail can climb during the day, D is the distance in feet that the snail slides down during the night, and F is the fatigue factor expressed as a percentage. The snail never climbs a negative distance. If the fatigue factor drops the snail's climbing distance below zero, the snail does not climb at all that day. Regardless of how far the snail climbed, it always slides Dfeet at night.

Output 


For each test case, output a line indicating whether the snail succeeded (left the well) or failed (slid back to the bottom) and on what day. Format the output exactly as shown in the example.

Sample Input 

6 3 1 10
10 2 1 50
50 5 3 14
50 6 4 1
50 6 3 1
1 1 1 1
0 0 0 0

Sample Output 

success on day 3
failure on day 4
failure on day 7
failure on day 68
success on day 20
failure on day 2



Miguel A. Revilla 
1998-03-10

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

一只蜗牛白天向上爬U,晚上向下滑D,U每天减小最开始U的F%,问第几天会成功(或失败)。


#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int f;double h,u,d;
    while(~scanf("%lf%lf%lf%d",&h,&u,&d,&f))
    {
        if(h==0) break;
        double sum=u;
        int day=1;
        double per=u*f/100.0;
        while(sum<=h)
        {
            sum-=d;
            if(sum<0) break;
            if(u>=per) u-=per;
            else u=0;
            sum+=u;
            day++;
            //cout<<"u="<<u<<endl;
            //cout<<"sum="<<sum<<endl;
        }
        if(sum>h) printf("success on day %d\n",day);
        else if(sum<0) printf("failure on day %d\n",day);
    }
    return 0;
}


ROSTEA软件下载及情感分析详细操作教程(附网盘链接) 原ROST虚拟团队出品的ROST系列文本内容挖掘分析平台,是辅助人文社会科学研究的免费计算平台。该软件可以实现文本预处理、分字、分词、词性识别、特殊名词抽取、词频统计、英文词频统计、情感计算、分类算法、聚类算法等一系列文本挖掘,是人文社科研究和论文写作的一把利器。该软件用户量超过一万人,遍布海内外100多所大学,包括剑桥大学、日本北海道大学、北京大学、清华大学、香港城市大学、澳门大学等众多高校。关于ROSTCM6的安装介绍可以参考之前的文章ROSTCM6软件下载及语义网络分析详细操作教程ROST EA。 阅读详情

相关推荐

Android 14密钥管理深度解析:从Keystore到Keymint的架构演进与Trusty安全实践

本文深入解析Android 14密钥管理系统的架构演进,从Keystore到Keymint的技术升级,以及Trusty安全环境的最佳实践。详细探讨了Keystore2的性能优化、Keymint的标准化设计,以及如何在Trusty TEE中实现安全密钥管理,为开发者提供构建现代密钥管理系统的实用指南。

weixin_42533120的博客 263

01 老干妈Python-首章

自然语言 vs 计算机语言 面对俩资料老干妈,从文入武,想想可能只有从语言的共性入手了。 目标:尝试去描述Python语言学习的过程,约束并制定后续讲解的节奏,以及加强每个阶段学习的目的性。 语言学可分为自然语言和人工语言两大类。 自然语言:人类在自身发展过程中形成的语言,是人与人传递信息的媒介 人工语言:人们为了某种目的而自行设计的语言 计算机语言:一种人工语言,是人与...

孤梦的小酒屋 1149

Gartner《构建可扩展数据产品建设框架》心得

数据产品化:从概念到落地的实践指南 当前企业正从传统数据需求模式转向数据产品化新范式。本文系统阐述了数据产品的核心价值、定义分类和实施框架,指出成功关键是将数据包装为可复用、可扩展的产品。Gartner框架强调产品思维,提出4阶段12步实施路径,涵盖设计、工程、发布和监控全流程。文章特别提醒要避免7大常见误区,如简单重命名报表、忽视元数据治理等,建议采取MVP策略,90天内完成从价值验证到产品落地的闭环。实施中需平衡技术选型与业务需求,建立跨职能团队,并通过AARRR模型持续追踪产品价值。

2501_91410404的博客 1005

The Snail ——蜗牛逃出井

The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The s

A_Happy_ACMer 1016

MATLAB随机生成m个三维坐标点,且各个坐标点之间的距离不小于n

randi函数 randi(max,m,n); %生成均匀分布的随机整数,max生成的随机整数最大值,生成m行n列的矩阵 编写函数sampling function [x,y,z]=sampling(lowx,upx,lowy,upy,lowz,upz,m,n) %该函数用来产生不重复的随机整数矩阵 %low—随机整数下界;up—随机整数上界;m—坐标点个数;n—各个坐标点之间的最小距离 %编...

qq_45384561的博客 9436

HFSS/ADS仿真实操:手把手调优一个2.4GHz SAW滤波器的IDT结构

本文详细介绍了使用HFSS和ADS仿真工具优化2.4GHz表面声波滤波器(SAW)的IDT结构。从材料参数设置到IDT建模,再到参数化扫描与频率调谐,提供了实用的操作步骤和优化技巧,帮助工程师快速掌握SAW滤波器的设计方案与性能调优方法。

weixin_29197835的博客 531

UVA - 573 The Snail

题意:

七夜 537

STC8H硬件IIC从机模式实战:手把手教你驱动OLED屏幕(附完整代码)

本文详细介绍了如何使用STC8H单片机的硬件IIC从机模式驱动SSD1306 OLED屏幕,包括硬件连接、寄存器配置、中断处理和实际应用中的优化技巧。通过完整的代码示例和实战经验分享,帮助开发者快速掌握I2C通信协议和OLED屏幕驱动技术,提升嵌入式开发效率。

weixin_33747129的博客 336

HDU 1302 The Snail(简单数学题)

HDU 1302 The Snail(简单数学题)

1719

设备树实践:从零构建一个嵌入式板级的设备树描述

本文详细介绍了如何从零开始为嵌入式Linux系统构建设备树(Device Tree),以i.MX6ULL处理器为例,涵盖硬件分析、设备树语法、外设配置及调试技巧。通过实践指导,帮助开发者掌握设备树编写,实现硬件与软件的高效对接,提升嵌入式开发效率。

plum99的博客 306

GameFramework专栏目录

本专栏是专门介绍GameFramework框架的,持续更新中,如有疑问可留言,24小时内回复。

TxNet 4727

uva 573 - The Snail

The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail h

uva code 1226

MySQL 一一 MySQL基本使用

1、数据库 简单来说,所谓的数据库就是存储数据的容器,而且是永久存储的。 2、为什么需要数据库 3、为什么要学习MySQL数据库 最早MySQL数据,瑞典AB公司开发的一款开源型的关系型数据库。 随着时间的推移,瑞典AB公司把MySQL数据库转让给Sun公司(Java语言的创始公司) 后来,Sun公司经营不善,又把MySQL数据库转让给甲骨文公司(Oracle数据库) 4、数

Guizy 7万+

UVA 573 (暑假-数学 -F - The Snail)

The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top.The snail can climb 3 feetwhile the sun is up, but slides down 1 foot at night while sleeping.The snail ha

Bingo 1626

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

UVa 573 - The Snail

看到这题我就想起了小时候的那个脑筋急转弯

一只冰熊 930

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

UVA573 - The Snail

注意: 1. 判定成功的时候不要减去滑下的距离 2.上升距离为负时要保持为0 题目:     The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up

319

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

UVA 573 The Snail

题目蜗牛分析 If the fatigue factor drops the snail’s climbing distance below zero, the snail does not climb at all that day. In other words, the snail’s height will exceed the height of the well or become ne

已注销的博客 345

UVA573 The Snail

The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top.The snail can climb 3 feetwhile the sun is up, but slides down 1 foot at night while sleeping.The snail ha

潜水的程序猿 562

UVa 573 The Snail(蜗牛)

蜗牛问题有很多种问法,但是这里的问法最苛刻的就是判断结束的条件。 不管是什么题目,认真都题目都是很有必要的,当然英语水平也要提高!

mullerwch的专栏 1167

UVa 573 The Snail (模拟)

573 - The Snail Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=514 A snail is at the bottom of a 6-foot wel

AC,∑ndless 1238

UVa 573 - The Snail

The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail

ACM2272902662的专栏 750

uva 573 - The Snail

还好这道题不靠高精度  要不我也不知道怎么做了     #include #include #include #define eps 1e-8 int main() { #ifdef LOCAL freopen("in.txt","r",stdin); #endif // LOCAL double H,U,D,F; while(scanf("%l

泪无痕 592

POJ1563 HDU1302 ZOJ1710 UVA573 UVALive5318 The Snail【模拟】

The SnailTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2016 Accepted: 960DescriptionA snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet whil...

海岛Blog 775
上一篇: UVA 591 - Box of Bricks(数学)
下一篇: UVA 846 - Steps(数学)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值