HDOJ 1302(UVa 573) The Snail(蜗牛爬井)】的更多相关文章

Problem Description A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on ea…
题目大意:有一只蜗牛位于深一个深度为h米的井底,它白天向上爬u米,晚上向下滑d米,由于疲劳原因,蜗牛白天爬的高度会比上一天少f%(总是相对于第一天),如果白天爬的高度小于0,那么这天它就不再向上爬,问这只蜗牛在几天爬出井口或滑下井底. 很直接的题,就是纠结于当蜗牛白天不爬的时候,下一天它是继续不爬还是向上爬u米,这个题的意思应该是以后白天都不再向上爬.还有就是注意边界,成功(>h)和失败(<0). #include <cstdio> int main() { #ifdef LOCA…
  The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on each succ…
 The Snail  A snail is at the bottom of a 6-foot well and wants to climb to the top.The snail can climb 3 feetwhile the sun is up, but slides down 1 foot at night while sleeping.The snail has a fatigue factorof 10%, which means that on each successiv…
1141: 蜗牛爬树 [模拟] 时间限制: 1 Sec 内存限制: 128 MB提交: 377 解决: 60 统计 题目描述 阿门阿前一棵葡萄树,阿嫩阿嫩绿地刚发芽,蜗牛背著那重重的壳呀,一步一步地往上爬. 想必很多小伙伴都听过这首<蜗牛与黄鹂鸟>,那么现在知道了蜗牛所爬树的高度.蜗牛白天爬一段距离,但是晚上将会下落一段距离. 求蜗牛爬到树顶是在第几天. 输入 每次测试只有一组测试数据. 每一行有三个整数,h,n,m(1≤h,n,m≤1000)分别代表树的高度.蜗牛白天爬的距离.蜗牛晚上下落的…
题意是一只虫子在深度为 n 的井中,每分钟向上爬 u 单位,下一分钟会下滑 d 单位,问几分钟能爬出井. 本人是直接模拟的,这篇博客的分析比较好一些,应当学习这种分析问题的思路:http://www.cnblogs.com/A--Q/p/5719353.html 代码如下: #include <bits/stdc++.h> using namespace std; int main() { int n,u,d,pos,ans; while(~scanf("%d%d%d",&…
PTA 7-46 爬动的蠕虫 #include<stdio.h> int main() { ; scanf("%d%d%d",&N,&U,&D); R = N-U; ) T=; else { T = R/(U-D)*+; ; } printf("%d",T); } 分析: 1.首先判断R=N-U是否大于0,若小于0则一分钟即可爬出 2.再计算R包含几个U-D(以两分钟为一周期,则在累计距离大于R前不可能爬出,因为即使累计距离达到了…
#include <stdio.h> #include <stdlib.h> int main() { int dayTh; float Udis,currentHeight,firstClaim,HeightOfWell,downDis,fagtigue; while(scanf("%f %f %f %f",&HeightOfWell,&Udis,&downDis,&fagtigue)!=EOF){ ) break; curre…
如果觉得资源不错,友情转发,贵在分享!!! 少儿编程Scratch: 少儿编程Scratch第一讲:Scratch完美的初体验少儿编程Scratch第二讲:奇妙的接球小游戏少儿编程Scratch第三讲:宇宙大战.枪战游戏少儿编程Scratch第四讲:射击游戏的制作,克隆的奥秘少儿编程第五讲:Scratch练习一坐标和移动少儿编程Scratch第六讲:抽奖游戏之造型.随机和广播少儿编程Scratch第七讲:字母雨打字练习少儿编程Scratch第八讲:变量和太空大战少儿编程Scratch第九讲:小猫…
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494 - Kindergarten Counting Game 414 - Machined Surfaces 490 - Rotating Sentences 445 - Marvelous Mazes…