简单模拟。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; int h1,h2;
int a,b; int main()
{
scanf("%d%d",&h1,&h2);
scanf("%d%d",&a,&b);
if(h1+*a>=h2) printf("0\n");
else if(h1+*a<h2&&b>=a) printf("-1\n");
else
{
h1=h1+*a;
int ans=;
while()
{
ans++;
h1=h1-*b;
h1=h1+*a;
if(h1>=h2) break;
}
printf("%d\n",ans);
}
return ;
}

CodeForces 652A Gabriel and Caterpillar的更多相关文章

  1. Code Forces 652A Gabriel and Caterpillar

    A. Gabriel and Caterpillar time limit per test 1 second memory limit per test 256 megabytes input st ...

  2. codeforces 652A A. Gabriel and Caterpillar(水题)

    题目链接: A. Gabriel and Caterpillar time limit per test 1 second memory limit per test 256 megabytes in ...

  3. Educational Codeforces Round 10 A. Gabriel and Caterpillar 模拟

    A. Gabriel and Caterpillar 题目连接: http://www.codeforces.com/contest/652/problem/A Description The 9-t ...

  4. Educational Codeforces Round 10

    A:Gabriel and Caterpillar 题意:蜗牛爬树问题:值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1: day = (End - Begin - day0)/ ...

  5. Educational Codeforces Round 10 A B题、

    A. Gabriel and Caterpillar 题意: 就是说  一个小孩子去观察毛毛虫从 h1的地方爬到h2的地方.毛毛虫从10点爬到22点.每小时爬的距离是a, 晚上22点到第二天早上10点 ...

  6. CodeForces 51F Caterpillar

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  7. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  8. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  9. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

随机推荐

  1. 软件设计模式详解:OCP原则

    看到两篇关于OCP的文章, 纳之. 原文:  http://www.cnblogs.com/muzongyan/archive/2010/08/05/1793454.html http://blog. ...

  2. ntp源码解读(一)

    /* * session_key - generate session key * * This routine generates a session key from the source add ...

  3. Bom2016/4/21

    Browser Object Model 浏览器对象模型 open(地址,打开方式) open('http://www.baidu.com','_self')本窗口打开百度 open('http:// ...

  4. js 去除html标签

    function removeHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag str = str.r ...

  5. AXIS-web.xml里配置axis报错addChild: Child name 'AxisServlet' is not unique 解决办法

    报错这个那么就表示,web.xml中有相同的AxisServlet的这个名字,可以把原来的删除配置自己的,也可以保留原来的,自己的不配置 Ctrl+f 搜索下就知道了

  6. zf-中间库(xzfw_xzjc_jianshi)

    比如说 xzfw_xzjc_jianshi 就是 建始的 一个中间库 这个(zwfw)是有个触发器,将数据交换到中间库xzfw_xzjc_jianshi 这个中间库 老版本没有交换工具,将数据交换到监 ...

  7. Highcharts获取json数据展现pie饼图

    实际上很多时候图表展现的数据都是从服务器端获取,现在来做一个简单的异步获取json数据的例子. 服务器端用Servlet3.0实现,JSP页面通过jquery异步请求json数据提供给Highchar ...

  8. POJ1611 The Suspects 并查集模板题

    题目大意:中文题不多说了 题目思路:将每一个可能患病的人纳入同一个集合,然后遍历查找每个点,如果改点点的根节点和0号学生的根节点相同,则该点可能是病人. 模板题并没有思路上的困难,只不过在遍历时需要额 ...

  9. ZOJ 3696 Alien's Organ 概率论 泊松分布

    看了好久的题,但还是看得一脸蒙圈,感觉完全无从下手,我的队友告诉我可能是正太分布之类的,但我感觉不太像,后来才听同学说是泊松分布,才恍然大悟,概率论刚刚学过这里不久,不禁感叹,学会了还要会用啊... ...

  10. android复习-AnsyTask

    AnsyTask是一种类似Thread+Hander机制的处理耗时操作的类, 通过在UI线程中excute()启动操作, 在AnsyTask中 doInBackground()中处理耗时操作(运行在自 ...