hdoj 1049 Climbing Worm 【水题】

告别信号干扰!用Altium Designer 19搞定4层/6层PCB叠层设计的保姆级流程 本文详细介绍了如何使用Altium Designer 19进行4层/6层PCB叠层设计,解决信号干扰问题。通过实际案例和系统方法论,涵盖高速数字电路、混合信号系统等典型场景的设计优化,帮助硬件工程师和学生掌握电磁兼容(EMC)与信号完整性(SI)的核心技术。 阅读详情

题目大意:一只蜗牛在深为n的井中, 每分钟往上爬u, 但是之后要歇一分钟,在这歇的一分钟中里下降d, 问什么时候蜗牛能爬出来,n为0的时候也算是出来了

Climbing Worm

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12272    Accepted Submission(s): 8275


Problem Description
An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm climbs out of the well? We'll always count a portion of a minute as a whole minute and if the worm just reaches the top of the well at the end of its climbing, we'll assume the worm makes it out.
 

Input
There will be multiple problem instances. Each line will contain 3 positive integers n, u and d. These give the values mentioned in the paragraph above. Furthermore, you may assume d < u and n < 100. A value of n = 0 indicates end of output.
 

Output
Each input instance should generate a single integer on a line, indicating the number of minutes it takes for the worm to climb out of the well.
 

Sample Input
10 2 1 20 3 1 0 0 0
 

Sample Output
17 19

水题直接上代码:

#include<stdio.h>
int main()
{
	int n, u, d, ans;
	while(scanf("%d%d%d", &n, &u, &d), n){
		int ans = 0;
		while(1){
			n-=u;
			++ans;
			if(n <= 0) break;
			else{
				n+=d;
				++ans;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


华为OD机试新系统真题 【LLM推理批次最大化】 华为OD机试 新系统真题【LLM推理批次最大化】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【LLM推理批次最大化】多语言题解。 阅读详情

相关推荐

微信小程序后台定位与实时位置更新的实战指南

本文提供了微信小程序实现后台定位与实时位置更新的完整实战指南。针对小程序退到后台后位置更新中断的痛点,详细解析了基于`startLocationUpdateBackground`API的后台定位解决方案。内容涵盖从隐私协议配置、项目权限声明,到授权、启动、监听、停止的核心代码流程,并分享了真机调试、性能优化及权限引导等关键避坑经验,帮助开发者构建稳定可靠的后台位置服务。

weixin_29008055的博客 484

hdoj1049解题报告

题意:1个长1英寸的虫子要从高n英寸的洞里爬出来,每分钟爬u英寸,但每爬一分钟需要休息一分钟,它会下滑d英寸,问它多长时间爬出来 分析:相当于每两分钟爬u - d英寸, 但最后一次是直接爬上去的,不会下滑,这是一种方法,我用的是直接模拟这个过程的方法. 代码如下: #include <iostream> using namespace std; int main() { ...

weixin_33778778的博客 128

GNSS-RTK/INS紧组合里,那个‘杆臂改正’到底怎么算?一个公式讲清INS与天线位置的关系

本文深入解析GNSS-RTK/INS紧组合导航系统中的杆臂改正(Lever Arm Correction)原理与实现方法。详细介绍了杆臂效应的物理本质、数学建模及误差扰动分析,揭示了IMU与GNSS天线位置关系的核心公式,并提供了工程实现中的常见误区与验证方法。通过Python代码示例和紧组合量测模型处理流程,帮助开发者准确理解并应用这一关键技术。

weixin_33137081的博客 364

ACM--贪心 水题---hdoj 1049

http://acm.hdu.edu.cn/showproblem.php?pid=1049 题目大意:一只虫子一不小心掉进一个n英寸深洞中。它有足够的能量来爬你每分钟英寸,但随后必须休息一分钟之前再次攀升。在休息期间,它滑落d英寸。攀爬的过程和休息然后重复。多久前的虫子爬出好吗?我们会永远数每分钟作为一个整体的一部分,如果虫子只是达到顶端的最后的攀爬,我们将假设蠕虫让出来。 分析:可以分析,...

Syy 396

RK平台MPP编解码实战:从源码编译到性能测试全解析

本文详细解析了在RK(瑞芯微)平台上进行MPP(Media Process Platform)多媒体编解码实战的全过程。从源码获取、交叉编译环境搭建、常见编译问题排查,到测试程序的修改调试与性能测试分析,提供了从零到一的完整指南。文章通过实测数据展示了MPP硬件编解码在嵌入式设备上的高性能与低功耗优势,帮助开发者快速掌握这一关键技术,应用于智能摄像头、视频会议终端等产品开发。

weixin_28273593的博客 552

AI Agent开发第82课-手把手教你把paddleocr-vl做成mcp使其在DIFY里运行

本文详解如何将国产顶尖多模态 OCR 模型 PaddleOCR-VL 封装为标准 MCP(Model Calling Protocol)服务,并通过自研的 HTTP-based MCP Client 接入 Dify 1.10,实现 AI Agent 在对话中自动识别并调用 OCR 能力。该方案已在某头部保险公司真实业务流程中落地,使用了当前最先进的“Agentic AI 原生”设计思想。

打造全国最全的AI Agent开发知识领域的博客 1631

【 OJ 】 HDOJ1049 模拟蜗牛爬出坑 [ 43 ]

这题模拟就好了....一直模拟u d 到出坑,看结果..当然最简单的还是找规律...用公式来计算...有点烦..懒得找了直接模拟AC了 # include&lt;iostream&gt; using namespace std; int main(void) { int n, u, d; int time , distance; cin &gt;&gt; n &gt;&...

博客 336

基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的农作物害虫检测系统(深度学习模型+UI界面+训练数据集)

随着人工智能技术在农业领域的深入应用,基于深度学习的害虫检测系统已成为智慧农业的重要组成部分。本文详细介绍了一种基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的农作物害虫检测系统,涵盖算法原理、数据集构建、模型训练、系统实现及完整代码。该系统能够实时检测并识别多种农作物害虫,为农业生产提供精准的病虫害监测解决方案。

YOLO 276

hdoj 1049 climbing worm(小学数学题)

思路:不多说了。。。。 代码如下: #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ #define p 3.1415927 int main(int argc, char *a

摆渡人的博客 251

GVINS数据采集(u-blox fp9 + D435i)

1、配置千寻的RTK账号 采集数据当天购买千寻的RTK账号,然后在Window下,输入账号和密码 (具体的步骤如之前面连接所示),查看u-center软件上的信息,确保接收机可以收到RTK信息; 2、查看Linux系统下u-blox是否可以正常接受GPS信号和RTK数据流 1、GPS信号信息 // 打开端口 1 cd ublox_f9p/src // 或者在终端1下也可以 source devel/setup.bash r.....................

努力努力努力 2614

【硬刚Hadoop】HADOOP MAPREDUCE(1):概述

本文是对《【硬刚大数据之学习路线篇】从零到大数据专家的学习指南(全面升级版)》的Hadoop部分补充。 1 MapReduce定义 MapReduce是一个分布式运算程序的编程框架,是用户开发“基于Hadoop的数据分析应用”的核心框架。 MapReduce核心功能是将用户编写的业务逻辑代码和自带默认组件整合成一个完整的分布式运算程序,并发运行在一个Hadoop集群上。 2MapReduce优缺点 2.1 优点 1)MapReduce易于编程 它简单的实现一些接口,就可以完成一个分布式程序..

微信搜:import_bigdata,大数据领域硬核原创作者 469

hdoj1049

hdoj1049

zzu-hust-madd 458

【ArcGIS Pro微课1000例】0073:ArcGIS Pro3.5.2学习版下载及安装教程

ArcGIS Pro 3.5.2安装教程摘要:系统需Windows10及以上,8GB内存(推荐32GB)。安装步骤:1)安装.NET 8.0运行环境;2)执行主程序安装包,按向导完成基础安装;3)安装升级补丁;4)替换AfCore.dll文件并导入注册表。注意安装后删除临时文件节省空间。软件下载地址包含在百度网盘链接。安装过程需依次完成环境配置、主程序安装、补丁更新及破解步骤。

智慧空间实验室 1814

ACM--虫子爬井--模拟--HDOJ 1049--Climbing Worm--水

HDOJ题目地址:传送门 Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16407    Accepted Submission(s): 11180 Problem

戎码人生 1915

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

【hdoj_1049】Climbing Worm

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1049 以 上升-下降 一次为一个周期,一个周期时间为2分钟,每个周期上升距离为(u-d)。先只考虑上升,再只考虑下降。先上升n/u次,再下降n/u次,这样保证不会超过井口,这样上升和下降各n/u次之后离井口距离为 n-(u-d)*(n/u),用时n/u分钟。最后一定会出现这样的情况,离井口的距离 用D

tensory的博客 672

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

hdoj 1049 Climbing Worm

<br />hdoj 1049  Climbing Worm<br /> #include<iostream> using namespace std; int n,u,d; int main(){ int n; while(cin>>n&&n!=0){ cin>>u>>d; int ti=0; int len=0; while(len<n){ ti++; l

CandyLien 549

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

[HDOJ 1049] Climbing Worm (基础题)

题目窗口:---->http://acm.hdu.edu.cn/showproblem.php?pid=1049 基础题,基本没挑战性。不过看着一次性AC,心里特滋润,嘿嘿。 5471645 2012-03-05 13:23:55 Accepted 1049 0MS 284K 363 B C++ ajioy #include using n

AJIOY的专栏 1090

HDOJ 1049 Climbing Worm 找规律(模拟题 )简单

java

人言束负兑生|完美是完蛋的开始 186

HDOJ--1049--Climbing Worm

题目描述: An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats

猩猩是个好程序员的博客 203

hdoj 1049 Climbing Worm

Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13179    Accepted Submission(s): 8883 Problem Description An inch worm

世界很大 477

hdoj1049 Climbing Worm

Climbing Worm<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 5203    Accepted Submission(s): 3145<br /><br />Problem DescriptionAn inch worm is at the bottom of a well n inches deep. It ha

独行闹市无人问,青灯剑影响素琴 804

(HDOJ 1049)Climbing Worm

Climbing WormProblem DescriptionAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. D...

aeg84268的博客 95

HDU 1049 ( Climbing Worm )

Problem : 1049 ( Climbing Worm ) Judge Status : Accepted RunId : 5794876 Language : C++ Author : ssun Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta #include&lt;ios...

weixin_33957648的博客 95

HDOJ_1049Climbing Worm(爬)

Problem Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, i

Cynical丶Gary_博客 532

HDOJ1049 Climbing Worm

Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20524    Accepted Submission(s): 14052 Problem Description An inch worm i

BarryLee的博客 310

hdoj 1049 Climbing Worm【贪心】

 Climbing Worm Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14519    Accepted Submission(s): 9817 Sample Input 10 2 1 20 3 1 0 0 0

nailnehc的博客 419
上一篇: hdoj 1097 A hard puzzle 【找规律】
下一篇: hdoj 1257 最少拦截系统 【贪心】
shengweisong
博客等级 码龄13年 55粉丝 383原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值