【杭电】[1302]The Snail
来源:互联网 发布:网络理财可靠吗 编辑:程序博客网 时间:2024/06/05 05:15
蜗牛爬井问题
不同的这次加入了疲劳度
每一天的上升距离要下降
u-=f
(注意不是以当前的距离下降f%,而是以初始的f%)
模拟这一过程
在其中加入越界判断就好
#include<stdio.h>int main() { double h; while(scanf("%lf",&h),h) { double u,d,f; scanf("%lf %lf %lf",&u,&d,&f); int cnt=1; double t=0; f=f/100.0*u; while(1) { t+=u; if(t>h) break; t-=d; if(t<0) break; u-=f; cnt++; } if(t<0) printf("failure on day %d\n",cnt); else printf("success on day %d\n",cnt); } return 0;}
题目地址:【杭电】[1302]The Snail
0 0
- 杭电1302-The Snail
- 杭电1302 The Snail
- 杭电1302 The Snail
- 【杭电】[1302]The Snail
- The Snail(杭电 1302)
- 杭电 HDU ACM 1302 The Snail
- 杭电 OJ 1302 The Snail
- 杭电ACM-The Snail
- 杭电ACM1302——The Snail
- HDU 1302 The Snail
- hdu 1302 The Snail
- hdoj 1302 The Snail
- hdu 1302 The Snail
- hdu -1302 The Snail
- HDOJ The Snail 1302
- hdoj 1302 The Snail
- HDU 1302 The Snail
- HDU 1302 The Snail
- JSF1063:警告!将不可序列化属性值设置为 HttpSession(密钥:{0},值类:{1})。
- C/C++中的位运算
- MFC 之工具栏设计
- JSF使用注解的时候
- win7左侧任务栏变得更窄的方法
- 【杭电】[1302]The Snail
- LeetCode 47 Permutations II
- Android Picasso的简单使用
- R语言-代码规范(Google's R Style Guide)
- LeetCode--No.206--Reverse Linked List
- 5.2 网络训练
- x64通过PspCidTable遍历进程
- Ubuntu 安装开源微信(源码安装+release快速安装)
- 第13课:Spark Streaming源码解读之Driver容错安全性