思维体操: 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年来的不断演进,以前发的早期教程已经太落后了,包括 ...
随机推荐
- STL::allocator rebind
阅读侯捷的STL源码剖析时,发现在allocator类的代码中有这样一个struct template<class T> class allocator { ... template< ...
- js-计算textarea可剩余的字数???
效果图 HTML: JS:
- 在 Cloudera Data Flow 上运行你的第一个 Flink 例子
文档编写目的 Cloudera Data Flow(CDF) 作为 Cloudera 一个独立的产品单元,围绕着实时数据采集,实时数据处理和实时数据分析有多个不同的功能模块,如下图所示: 图中 4 个 ...
- yarn与npm对比
https://www.jianshu.com/p/254794d5e741(copy)
- VSCode支持jsx自动补全
点击settings.json中编辑, 把这段话加上去就可以了 "emmet.includeLanguages": { "javascript": " ...
- PID221 / 烦人的幻灯片☆ x
超详细解释!我都被我自己惊呆了! (这个题目意思我缓冲了很久!一定要读懂题!否则做不出来) 题目不懂就多读呀~ 提交你的代码 查看讨论和题解 题目描述 李教授于今天下午做一个非常重要的演讲.不幸的是他 ...
- python安装报错error writing to file:......
今天换了win10 64电脑,安装python3.6.8时,报错:error writing to file:...... 安装时,右键--以管理员身份运行,安装成功.
- You have 1 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): shopadmin. Run 'python manage.py migrate' to apply them.
数据库迁移时报错, You have 1 unapplied migration(s). Your project may not work properly until you apply the ...
- nginx 日志文件分隔
Nginx命令 Nginx命令帮助如下 nginx -h nginx version: nginx/0.8.45 Usage: nginx [-?hvVt] [-s signal] [-c filen ...
- [BZOJ4804]欧拉心算:线性筛+莫比乌斯反演
分析 关于这道题套路到不能再套路了没什么好说的,其实发这篇博客的目的只是为了贴一个线性筛的模板. 代码 #include <bits/stdc++.h> #define rin(i,a,b ...