poj1563---蜗牛爬井
#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){
if(HeightOfWell==)
break;
currentHeight=;
firstClaim=Udis;
dayTh=;
while(){
currentHeight+=Udis;
Udis-=fagtigue/*firstClaim;
if(Udis<)
Udis=;
dayTh++;
if(currentHeight>HeightOfWell){
printf("success on day %d\n",dayTh);
break;
}
else{
currentHeight-=downDis;
if(currentHeight<)
{
printf("failure on day %d\n",dayTh);
break;
}
}
}
}
return ;
}
WA过,注意当Udis<0,Udis=0;变量都赋值成float
poj1563---蜗牛爬井的更多相关文章
- 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 sna ...
- HPU--1141 蜗牛爬树
1141: 蜗牛爬树 [模拟] 时间限制: 1 Sec 内存限制: 128 MB提交: 377 解决: 60 统计 题目描述 阿门阿前一棵葡萄树,阿嫩阿嫩绿地刚发芽,蜗牛背著那重重的壳呀,一步一步地往 ...
- HDU 1049(蠕虫爬井 **)
题意是一只虫子在深度为 n 的井中,每分钟向上爬 u 单位,下一分钟会下滑 d 单位,问几分钟能爬出井. 本人是直接模拟的,这篇博客的分析比较好一些,应当学习这种分析问题的思路:http://www. ...
- PTA——蠕虫爬井
PTA 7-46 爬动的蠕虫 #include<stdio.h> int main() { ; scanf("%d%d%d",&N,&U,&D) ...
- 573 The Snail(蜗牛)
The Snail A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can ...
- 少儿编程|Scratch编程教程系列合集,总有一款适合你
如果觉得资源不错,友情转发,贵在分享!!! 少儿编程Scratch: 少儿编程Scratch第一讲:Scratch完美的初体验少儿编程Scratch第二讲:奇妙的接球小游戏少儿编程Scratch第三讲 ...
- C#学习笔记(二十):C#总结和月考讲解
m1w1d2_console_variable_constant 输入Console.WriteLine(); 输出Console.ReadLine(); 快捷键 折叠代码:快捷键“Ctrl+ K + ...
- C#学习笔记(五):while循环和for循环
while循环 while循环和for循环,可以相互替换,范围和效能一样,理解事物的逻辑不一样 while循环用于条件不确定的逻辑 for循环用于计算次数的逻辑 for循环 快捷写法,按两下TAB i ...
- P1834 种花小游戏
我只是想做壮鸭低劈啊,为什么只有状压没有DP-- 原题: 植物大战僵尸这款游戏中,还有个特别有意思的赚钱方式--种花(能长金币的花).种出来的金币需要玩家点击才能得到,或者,玩家可以购买一只蜗牛来帮助 ...
随机推荐
- 初学Django
纵然有众多大牛写过这些简单入门文章,但作为记录,还是要自己动手写下来的比较靠谱,‘好脑筋不如烂笔头’啊! Python 安装 Django本身是纯Python编写的,所以安装框架的第一步是确保你已经安 ...
- redBag
var redBag = (function () { var initialed = false, raining = true, createInterval, walkInterval, cre ...
- leetcode算法刷题(三)
今天在刷了几道简单的动态规划后,又看了看string方面的题 第五题 Longest Palindromic Substring 题目的意思:求一个字符串的最长回文子串 分析:开始,我的想法是,现在字 ...
- 无良教程-破解SublimeText3
这教程实际上并不是倡导大伙儿去破解软件然后传播出去以侵犯作者的权益,纯粹是技术分享,如果大伙儿觉得Low了,可立马删除. sublime text是我非常喜欢的一款编辑器,在ubuntu上,之前用的一 ...
- Oracle EBS-SQL (PO-2):检查当月到货补单的记录数.sql
SELECT DECODE(PLLA.FROM_LINE_ID,'-1','手工','','自动创建') 下达方式, rsh.receipt_num ...
- ListView的Item点击事件(消息传递)
转载请保留原文出处“http://my.oschina.net/gluoyer/blog”,谢谢! 您可以到博客的“友情链接”中,“程序猿媛(最新下载)*.*”下载最新版本,持续更新!当前版本,也可直 ...
- Qt 中程序自动重启
参照至 dbzhang老师的博文,记录于此....... 要想理解重启,先得看看Qt程序怎么退出! 1.退出 int main(int argc, char** argv) { QApplicatio ...
- Codeforces 325D
#include <cstdio> #include <algorithm> #include <cstring> #include <cstdlib> ...
- wx.BookCtrlBase
wx.BookCtrlBase A book control is a convenient way of displaying multiple pages of information, disp ...
- win10系统 Visual Studio 2013 Color Theme Editor插件 安装出错
下载这个版本,用vs2013打开安装即可:http://pan.baidu.com/s/1hrcfY1A