简单模拟。

#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. linux ubuntu平台下安装Scrapy

    1.安装Python sudo apt-get install python2.7 python2.7-dev 2.安装pip 下载get-pip.py 选中该文件所在路径,执行下面的命令 sudo ...

  2. gameUnity 0.2 网络游戏框架(计划)

    能说的就是 请大家都耐心等待,不做国产垃圾,只追求国外经典,这就是 这套框架未来的发展 一:2d 3d场景融合  人物移动 2d 3d 层 移动 有差值(共6层,2d天空层.前景3d物体层有 景深), ...

  3. 使用Qt报错error while building deploying project

    方法一:点击左侧的“项目”栏,看“构建目录”栏的路径,一定要注意,在路径中一定不要出现汉字,否则一定会报“error while building deploying project”的错误. 方法二 ...

  4. 转:HTTP协议详解(真的很经典)

    转自:http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx Author :Jeffrey 引言 HTTP是一个属于应用层的面向对象的 ...

  5. 转:Selenium-Grid工作方式

    Selenium-Grid版本 selenium-grid分为版本1和版本2,其实它的2个版本并不是和selenium的版本1和2相对应发布的[即selenium-grid2的发布比selenium2 ...

  6. STM32F4xx FPU的设置

    原文:http://blog.csdn.net/dlutxie/article/details/7980389 浮点运算一直是定点CPU的难题,比如一个简单的1.1+1.1,定点CPU必须要按照IEE ...

  7. ssh能够连接而sftp不能连接的解决方法

    ssh能够连接而sftp不能连接的解决方法   昨天开始用FileZilla一直不能登录远程的服务器,ssh的登录就OK,因为是服务器,也不敢乱动.查了好多资料终于解决了. 首先,查看一下系统的安全日 ...

  8. 利用php函数mkdir递归创建层级目录

    项目开发中免不了要在服务器上创建文件夹,比如上传图片时的目录,模板解析时的目录等.这不当前手下的项目就用到了这个,于是总结了几个循环创建层级目录的方法. php默认的mkdir一次只能创建一层目录,而 ...

  9. Codeforces Round #363 (Div. 2) C. Vacations(DP)

    C. Vacations time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  10. 如何在Apache中配置多端口访问

    环境: Windows server 2008 R2, Apache, PHP5 步骤: 建立一个目录,里面放置一个index.php. 打开Apache\conf\httpd.conf 文件,做如下 ...