标签:
简单模拟。
#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; }
CodeForces 652A Gabriel and Caterpillar
标签:
原文地址:http://www.cnblogs.com/zufezzt/p/5322377.html