Climbing Worm

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

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
 
Source
 
 
 #include <stdio.h>

 int main()
{
int n,u,d;
while(scanf("%d %d %d",&n,&u,&d),n)
{
int t;
t=(n-u)/(u-d);
if(((n-u)%(u-d))!=)
t+=;
printf("%d\n",t*+);
}
return ;
}

简单题

 

hdu_1049_Climbing Worm_201311061331的更多相关文章

随机推荐

  1. Istio 1.1部署实践

    前提条件 正确安装配置Kubernetes集群 CentOS Linux release 7.5.1804 安装 下载istio 1.1版本 [root@vm157 ~]# wget https:// ...

  2. 异常强大的Markdown编辑插件-Markdown Preview Enhanced

    最近使用Markdown写作,了解到以下这些Markdown写作工具 MaHua 在线markdown编辑器 百度搜索Markdown时,它排在非常靠前的位置 马克飞象- 专为印象笔记打造的Markd ...

  3. 关于postman软件的安装与使用

    1.这个软件是一个模拟发请求的软件 2.这个软件和这个网站的 json 格式数据有着很好的关系  https://www.json.cn/ 他能帮助我们分解代码, 3.在使用(修改的)过程中发现了一个 ...

  4. idea ssm项目移包报错问题

    写完代码之后发现包结构太乱了  想要规划一下  结果报错 这里面的包路径都可以点进去,还是报找不到com.lf.company.entity.Business 后来发现是 在移动前和移动后都存在这个m ...

  5. 通过Oracle透明网关连接Sybase

    Oracle公司提出的透明网关技术可用于实现与其他多种类型的数据库的互联,实现不同类型数据之间建立连接,方便于使用者进行查询.近日,在公司的某项目的实施过程中,开发人员需要访问Sybase数据库中的某 ...

  6. 笨拙而诡异的 Oracle

    有这样一段 SQL 代码: 通过 C# 获取查询结果:    SQL 代码中有两个参数,且都是字符串类型,以上的 C# 代码是生成 Oracle SQL 代码所需要的参数.运行结果如下:   居然发生 ...

  7. Android视频截图

    本文介绍如何获取视频中某个时间点的数据 调用以下方法即可,特别注意,在获取图片时的参数单位为微秒,不是毫秒 如果错用了毫秒会一直获取第一帧的画面 /** * 获取某个时间点的帧图片 * * @para ...

  8. [Android]异常7-Error:Configuration with name 'default' not found.

    背景:使用SVN更新代码,运行出现 异常原因: 可能一>缺少Modules 解决办法有: 解决一>Android Studio切换为Project,settings.gradle中引用和现 ...

  9. 如何成为一名出色的Oracle数据库管理员

    主要针对Oracle DBA在成长阶段的定位,学习方法等几大方面进行了经典的论述,详细内容请参考下文. 一.定位 Oracle分两大块,一块是开发,一块是管理.开发主要是写写存储过程.触发器什么的,还 ...

  10. [Windows Server 2012] 安装SQL Server 2012

    ★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:安装SQL S ...