1.2.1Climbing Worm(附翻译)

Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 5750 AcceptedSubmission(s): 3389

Problem Description

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

一英寸蠕虫在深井的底部。 它有足够的能量每分钟爬上u英寸,但在再次爬升之前需要休息一分钟。 在休息期间,它会滑下餐桌。 然后攀爬和休息的过程重复。 在蠕虫爬出井之前多久? 我们总是将一分钟的一小部分计为一分钟,如果蠕虫在爬坡结束时刚刚到达井顶,我们就会认为蠕虫将其排除。

Input

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

将会有多个问题实例。每行将包含3个正整数n,u和d。 这些给出了上面段落中提到的值。 此外,您可以假设d <u和n <100。n = 0的值表示输出结束。

Output

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

每个输入实例应该在一行上生成一个整数,表示蠕虫爬出井所需的分钟数。


10 2 1
20 3 1
0 0 0

Sample Output

17
19

本题解题难度在于在攀爬过程中还不断下滑,而且需要额外注意并不是每次爬都有一次下滑,例如第一个实例当爬到8的位置再往上爬2就直接出去了,a为井深,b是速度,c是下滑距离,采用的方法就是以a-b的距离除以b-c的速度因为是自动取整,所以要是有余数就+1,这算的是爬的次数,因为每次爬一上一滑两秒所以*2,后面+1是因为前面路程-b了(写晕了,也不知道咋解释,手动捂脸)

c++

#include<iostream>
using namespace std;
int main(){
	int a,b,c,d;
	while(cin>>a>>b>>c&&a!=0){
		if((a-b)%(b-c)!=0){
			d=((a-b)/(b-c)+1)*2+1;
		}else{
			d=((a-b)/(b-c))*2+1;
		}
		cout<<d<<endl;
	}
	return 0;
}

运行截图



Unity中有多个Climbing System插件,但最流行和常用的是Climbing System Pro插件。下面是Climbing System Pro插件的文档: 1. 简介 Climbing System Pro是一款Unity插件,用于快速创建高品质的爬山系统。它支持多种爬山类型,包括攀岩、墙壁攀登、梯子攀爬等。Climbing System Pro具有一些强大的功能,例如手部IK、动画融合、多个爬山点的支持等。 2. 安装 您可以在Unity Asset Store中找到Climbing System Pro插件并进行安装。安装完成后,您可以在Unity编辑器中看到Climbing System Pro的菜单选项。 3. 快速入门 要创建一个基本的爬山系统,您需要执行以下步骤: - 创建一个包含Mesh Collider组件的游戏对象,用于表示可爬物体。 - 将Climber组件添加到要进行爬山的角色上。 - 在Climber组件中选择“Add Climbing Point”选项,添加一个或多个爬山点。 - 在Climber组件中选择“Set Climbing Type”选项,选择爬山类型(例如攀岩、墙壁攀登等)。 - 按下游戏中的特定按键,以开始爬山。 4. 高级用法 Climbing System Pro还具有一些高级功能,例如动画融合、手部IK等。您可以通过查看Climbing System Pro的文档来了解更多信息。 5. 支持 如果您在使用Climbing System Pro时遇到了任何问题,您可以查看官方文档或联系开发者以获取支持。 以上是Climbing System Pro插件的简要文档,希望能够帮助您了解如何使用该插件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值