CodeForces 652A Gabriel and Caterpillar
2016-03-26 10:54
375 查看
简单模拟。
#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+8*a>=h2) printf("0\n"); else if(h1+8*a<h2&&b>=a) printf("-1\n"); else { h1=h1+8*a; int ans=0; while(1) { ans++; h1=h1-12*b; h1=h1+12*a; if(h1>=h2) break; } printf("%d\n",ans); } return 0; }
相关文章推荐
- JAVA Class String
- 利用CSS3新特性创建透明边框三角
- unity3D 如何提取游戏资源
- apache与Tomcat联系及区别
- 闽江学院2015-2016学年下学期《软件测试》课程-第二次作业(个人作业)题目一
- 开发心得
- 面试宝典之二 百度算法面试题分析
- 面试宝典之二 百度算法面试题分析
- 二、Java学习之语言基础(1)
- Repo和Git 版本管理常用命令
- 有状态与无状态,可变模式与不可变模式
- 面试宝典之二 百度算法面试题分析
- 使用马克飞象编辑Markdown
- C语言结构体变量字节对齐问题总结
- 对 ViewGroup 生命周期执行顺序的理解
- zookeeper错误记录一;Cannot open channel to 2 at election address s1/192.168.253.131:3888 java.net.Connec
- [LeetCode]Count Primes
- Cocos2d-x笔记记忆整理Day2
- 实验二 单元测试
- 和我一起学批处理(2)