Snail’s trouble
Snail’s trouble |
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 74 Accepted Submission(s): 51 |
Problem Description
Once upon a time, there was a poor snail. Every day, it tried very hard to crawl forward, while there was a keeper who’d like to maltreat this poor little snail. The snail was crawling on a one-meter rubber band at first, and it can move on k cm every minute. But after that, the keeper stretches the rubber band quickly, and it would be elongated one meter, during that the distances ratio between the snail and the two endpoints remain unchanged. In the next minute, little snail tried to keep moving forward again.
“Can I finally get to the endpoint?” The snail often asked himself such a question because he was afraid he would never succeed. Now, we hope you can tell this poor snail when he would reach the endpoint. |
Input
Every line of the input contains an integer number k, indicating that the snail moved forward k cm every minute. (5 <= k <= 100)
|
Output
Output an integer t, indicating that the snail doesn’t get to the endpoint until t-1 minutes later, while t minutes later, it finally succeed.
|
Sample Input
10 |
Sample Output
12367 |
Source
2009 Multi-University Training Contest 2 - Host by TJU
|
Recommend
gaojie
|
/*
题意:一个蜗牛初始的时候在一块长1米的橡胶上,速度为一分钟k厘米,在每分钟的末尾橡胶会很快的
拉长一米,但是蜗牛在橡胶上的比例位置不变。蜗牛第一次到达末尾的时间是多少 初步思路:简单的模拟嘛,但是很好时间,所以就打表
*/
#include<bits/stdc++.h>
using namespace std;
int n;
int a[]={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,};
int main(){
// freopen("in.txt","r",stdin);
// for(int n=5;n<=100;n++){
// int t=0;
// double sum=100;
// double w=0;
// while(true){
// t++;
// w+=n;//蜗牛走的
// if(w>=sum){
// cout<<t<<",";
// break;
// }
// double tmp=sum+100;
// w=tmp*w*1.0/sum;
// sum=tmp;
// }
// }
while(scanf("%d",&n)!=EOF){
printf("%d\n",a[n-]);
}
return ;
}
Snail’s trouble的更多相关文章
- 【BZOJ-1863】trouble 皇帝的烦恼 二分 + DP
1863: [Zjoi2006]trouble 皇帝的烦恼 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 559 Solved: 295[Submit] ...
- 快速幂 --- CSU 1556: Jerry's trouble
Jerry's trouble Problem's Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1556 Mean: 略. ana ...
- HDU 4334 Trouble (暴力)
Trouble Time Limit: 5000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Submit Statu ...
- The trouble of Xiaoqian
The trouble of Xiaoqian Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- Linux 常见的trouble shooting故障排错
Linux 常见的trouble shooting故障排错 备份开机所必须运行的程序对一个运维人员来说是非常有必要的.在实际生产环境中,系统和数据基本都是安装在不同的硬盘上面,因为企业最关心的还是数据 ...
- HDU 4334 Trouble
Trouble Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- 【BZOJ】【1863】【ZJOI2006】trouble 皇帝的烦恼
二分+DP Orz KuribohG 神题啊= = 满足单调性是比较显然的…… 然而蒟蒻并不会判断能否满足……QwQ 神一样的DP姿势:f[i]表示第 i 个与第1个最多有多少个相同,g[i]表示最少 ...
- UVA 10497 - Sweet Child Makes Trouble 高精度DP
Children are always sweet but they can sometimes make you feel bitter. In this problem, you will see ...
- 【DP/二分】BZOJ 1863:[Zjoi2006]trouble 皇帝的烦恼
863: [Zjoi2006]trouble 皇帝的烦恼 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 465 Solved: 240[Submit][ ...
随机推荐
- 关于sping quartz定时执行理解与思考
转载请注明原创出处,谢谢! 一直以为自己理解spring quartz,忽然最近几天发现自己理解的不对,在4月18号的时候,我执行了一个spring quartz的计划如下: 1 0 0 */3 * ...
- 利用原生js做数据管理平台
摘要:数据管理平台在当今社会中运用十分广泛,我们在应用过程中,要对数据进行存储,管理,以及删除查询等操作,而我们在实际设计的时候,大牛们大多用到的是JQuery,而小白对jq理解也较困难,为了让大家回 ...
- 深入理解计算机系统chapter2
---恢复内容开始--- 整数表示: 反码和原码都会有正零和负零 有符号整数和无符号整数之间的转换 反之 扩展一个数字的位级表示 截断操作 无符号加法的益处 补码的加法 规格化的值:E=e-bias ...
- swift 开发学习问题
1 UITableViewController 问题: [UITableView dequeueReusableCellWithIdentifier:forIndexPath:], unable to ...
- MySQL锁和事务(一):InnoDB锁(MySQL 官方文档粗翻)
// 写在前面,实际上,数据库加锁的类型和范围受到多种因素的影响,例如数据库隔离等级,SQL语句,是否使用主键.索引等等.可以查看博文: http://www.cnblogs.com/zhaoyl/p ...
- Java中的类型擦除与桥方法
类型擦除 Java在语法中虽然存在泛型的概念,但是在虚拟机中却没有泛型的概念,虚拟机中所有的类型都是普通类.无论何时定义一个泛型类型,编译后类型会被都被自动转换成一个相应的原始类型. 比如这个类 pu ...
- docker镜像文件导入与导出
工作中经常需要拉取一些国外的镜像,但是网络限制等原因在公司拉取很慢,所以我习惯用亚马逊服务器拉取镜像,导出后下载到本地再导入开发环境 1. 查看镜像id sudo docker images REPO ...
- Redis缓存项目应用架构设计二
一.概述 由于架构设计一里面如果多平台公用相同Key的缓存更改配置后需要多平台上传最新的缓存配置文件来更新,比较麻烦,更新了架构设计二实现了缓存配置的集中管理,不过这样有有了过于中心化的问题,后续在看 ...
- asp.net中使用Global.asax文件中添加应用出错代码,写入系统日志文件或数据库
void Application_Error(object sender, EventArgs e) { // 在出现未处理的错误时运行的代码 Exception objErr = Server.Ge ...
- haproxy + keepalived 实现网站高可靠
haproxy 1的配置文件,包括 keepalived 和 haproxy 的配置,分别如下: [haproxy 1的keepalived 配置文件] /etc/keepalived/keepal ...