Judge Info

  • Memory Limit: 32768KB
  • Case Time Limit: 10000MS
  • Time Limit: 10000MS
  • Judger: Number Only Judger

Description

One day frog Frank fall into a deep well, the well is very deep. Everyday Frank try to climb up, at day time, he can get himself  feet up, but when he fall sleep at night , he slipped feet down. The well is L feet deep.

Task

Now, it is your turn. Frank is asking you to find out, how many days needed for him to get out from the well. A day has two part, day time and night time. Frank must get higher than the well, or it is not count as get out.

Input

The first line of input contains , the number of test cases. There is one line for each test case, contains three integer numbers  as describe above.

Output

For each test case, print a line contains the solution, how many days need for Frank to get out from the well.If there is no way out, please output −1.

Sample Input

2
2 1 2
1 1 2

Sample Output

2
-1

被误解的思路:

本以为 A 2 B 1 L 2  一天就可以爬过去,原来 刚好 A = L 是过不去井口的。所以要 > 井口才可以出的去。

代码:

 #include<stdio.h>

 int main()
{
int A,B,L;
int t;
scanf("%d",&t);
while(t>)
{
scanf("%d%d%d",&A,&B,&L);
if(A<=B)
{
if(A<=L)
printf("-1\n");
else
printf("1\n");
}
else
{
if(A>L)
printf("1\n");
else
printf("%d\n",(int)((L-A)/(A-B))+);
}
t--;
} return ;
}

SZU : A18 (Climb Well)的更多相关文章

  1. 【暑假】[深入动态规划]UVa 12170 Easy Climb

    UVa 12170 Easy Climb 题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=24844 思路:  引别人一 ...

  2. P3436 [POI2006]PRO-Professor Szu

    P3436 [POI2006]PRO-Professor Szu 题目描述 n个别墅以及一个主建筑楼,从每个别墅都有很多种不同方式走到主建筑楼,其中不同的定义是(每条边可以走多次,如果走边的顺序有一条 ...

  3. Easy Climb UVA - 12170 滚动dp +离散化+ 单调队列优化

    E.Easy Climb Somewhere in the neighborhood we have a very nice mountain that gives a splendid view o ...

  4. [uva12170]Easy Climb

    还是挺难的一个题,看了书上的解析以后还是不会写,后来翻了代码仓库,发现lrj又用了一些玄学的优化技巧. #include <algorithm> #include <iostream ...

  5. Easy Climb

    题意: 有n块石头,给定他们的高度,现保持第一和最后一块高度不变,其他可增加和减少高度,求通过变换使所有相邻石头的高度差的绝对值不大于d,所变化高度总和的最小值. 分析: 状态还可以想出来,dp[i] ...

  6. SZU:B47 Big Integer II

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  7. SZU:D89 The Settlers of Catan

    Judge Info Memory Limit: 65536KB Case Time Limit: 3000MS Time Limit: 3000MS Judger: Number Only Judg ...

  8. SZU:B47 Big Integer I

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  9. SZU:G32 Mass fraction

    Judge Info Memory Limit: 32768KB Case Time Limit: 5000MS Time Limit: 5000MS Judger: Float Numbers (1 ...

随机推荐

  1. jsp 行动标签

    jsp行动标签 签.它影响JSP执行时的功能. 1.include动作标签 <jsp:include page="文件名称字"/> 或 <jsp:include  ...

  2. CodeForces 425E Sereja and Sets

    意甲冠军: 集S它包括了很多间隔[l,r]  和1<=l<=r<=n  f(S)个不相交的区间  问给出n和f(S)  有几种可能的S集合 思路: dp好题  至于为啥是dp-  我 ...

  3. table中的边框合并实例

    <html><head><style type="text/css">table,th,td{border:1px solid blue;bor ...

  4. WPF - Visual调试工具Snoop

    原文:WPF - Visual调试工具Snoop Snoop经过很长一段时间,最近更新到支持NET 3.5了,它是一个WPF运行时对Visual UI调试的一个工具,最近我用过它调试修改过一个bug, ...

  5. javascript实现数据结构:广义表

    原文:javascript实现数据结构:广义表  广义表是线性表的推广.广泛用于人工智能的表处理语言Lisp,把广义表作为基本的数据结构. 广义表一般记作: LS = (a1, a2, ..., an ...

  6. SVN & Git (一)

    (一)SVN的使用.CornerStone图形化管理工具! SVN是Subversion的简称,是一个开放源代码的版本控制系统,相较于RCS.CVS,它采用了分支管理系统,它的设计目标就是取代CVS. ...

  7. Yii Framework2.0开发教程(10)配合mysql数据库实现用户登录

    1.首先在mysql创建一个存用户的表格 create table test_user ( user_id bigint(20) unsigned not null auto_increment co ...

  8. 使用ButterKnife无法inject view的解决办法

    使用ButterKnife做android开发时,发现无法inject,如下,tvInfo总是null. @InjectView(R.id.textView1Info) TextView tvInfo ...

  9. 收集的VS2013的使用小技巧( 不断总结中)

    对于经常使用vs的朋友,如果能用键盘直接做的事,还是键盘更便捷点,现在我就把自己遇到的一些给写下来. 1.对一个函数的说明 先写一个函数,以及参数,完成后,在函数上输入///,vs会自动补全说明的信息 ...

  10. 使用八种牛云存储解决方案ios7.1的app部署问题

    使用八种牛云存储解决方案ios7.1的app部署问题 一个.问题叙述性说明 开发完ios版本号的app.须要将.ipa文件和.plist文件打包上传,供用户下载,在线安装.用户安装过程简单描写叙述例如 ...