思维体操: HDU1049Climbing Worm
Climbing Worm
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 19841 Accepted Submission(s): 13532
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.
of output.
10 2 1
20 3 1
0 0 0
17
19
We have carefully selected several similar problems for you: 1021 1019 1071 1009 1061
RunId : 21270620 Language : G++ Author : hnustwanghe
Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
int u,n,d,time;
while(scanf("%d %d %d",&n,&u,&d)==3 && (n||u||d)){
time = 1;
while(n-u>0){
time+=2;
n=n-u+d;
}
printf("%d\n",time);
}
}
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std; int main(){
int u,n,d,time;
while(scanf("%d %d %d",&n,&u,&d)==3 && (n||u||d)){
time = 1;
while(n-u>0){
time+=2;
n=n-u+d;
}
printf("%d\n",time);
}
}
思维体操: HDU1049Climbing Worm的更多相关文章
- 思维体操: HDU1287破译密码
破译密码 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 思维体操: HDU1008 Elevator
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
- 思维体操: HDU1022Train Problem I
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 2.Web开发过程流程图
转自:https://blog.csdn.net/hello_simon/article/details/19993343 最近公司在进行一系列新模块的开发,在痛苦开发的过程中,大家不时在一起进行总结 ...
- 题解-Koishi Loves Construction
题解-Koishi Loves Construction 前缀知识 质数 逆元 暴搜 Koishi Loves Construction 给定 \(X\),\(T\) 组测试数据,每次给一个 \(n\ ...
- &&与||的优先级比较
&&与||的优先级比较类似于一种思维体操,更多的是造成矛盾,使得两者因为先后顺序的不同而造成的不同结果,当然有时候需要注意c语言中的短路运算. 方法1. 代码如下: 点击查看代码 #i ...
- [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序
用菜鸟的思维学习算法 -- 马桶排序.冒泡排序和快速排序 [博主]反骨仔 [来源]http://www.cnblogs.com/liqingwen/p/4994261.html 目录 马桶排序(令人 ...
- Photoshop、Illustrator思维导图笔记
半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.
- CYQ.Data 从入门到放弃ORM系列:开篇:自动化框架编程思维
前言: 随着CYQ.Data 开始回归免费使用之后,发现用户的情绪越来越激动,为了保持这持续的激动性,让我有了开源的念头. 同时,由于框架经过这5-6年来的不断演进,以前发的早期教程已经太落后了,包括 ...
随机推荐
- Educational Codeforces round 78 A、B
链接:https://codeforces.com/contest/1278 A:Shuffle Hashing 题意:对于一个字符串p可以执行一个"hash"操作,首先将p内的元 ...
- TCP三次握手摘要
这个问题的本质是, 信道不可靠, 但是通信双发需要就某个问题达成一致. 而要解决这个问题, 无论你在消息中包含什么信息, 三次通信是理论上的最小值. 所以三次握手不是TCP本身的要求, 而是为了满足& ...
- [转] 数值优化(Numerical Optimization)学习系列-目录
from:https://blog.csdn.net/fangqingan_java/article/details/48951191 概述数值优化对于最优化问题提供了一种迭代算法思路,通过迭代逐渐接 ...
- PKUWC2020爆零记
抱歉,这么晚才更. 事实是:我都没有去 所以爆零了 QwQ
- Linux基本命令使用(一)
1.head -n 文件 可以查看文件前n行 tail -n 文件 可以查看文件的后n行 tail -f 文件 可以实时查看文件,比如日志在更新,就可以实时显示最后几行 ...
- JMS学习三(ActiveMQ消息的可靠性)
下面我们来学习一下消息接受确认和发送持久化消息.消息的过期.消息的选择器和消息的优先级. 一.消息接收确认 1.jms消息只有在被确认之后才认为成功消费了这条消息.消息的成功消费通常包括三个步骤:(1 ...
- lines
lines Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- CSS 处理溢出强行换行
CSS折行样式 word-break:break-all;允许单词拆分折行 word-break:keep-all;只能在半角空格或连字符处换行. word-wrap:break-word;在长单词或 ...
- [design pattern](3) Dectorator
前言 很久没有写关于设计模式的博客了,实在是没有太多的精力去写.但个人觉得设计模式在我们的日常开发中还是挺重要的,它提高了软件的可维护性.因此还是有必要坚持学习设计模式,写博客主要是为了加深我对设计模 ...
- sqli-labs(35)
0X01 构造闭合 发现不需要闭合 ?id=- union ,database(), 0X02组合拳打法