这题的题意是这样的:
这个人每天两点去观察毛毛虫,毛毛虫一开始在h1的位置,要去h2位置的苹果的地方,毛毛虫白天能上升a米/h,晚上要睡觉所以要下降b米/h,假设每天10点为白天,晚上10变成黑夜,问你毛毛虫要几天才能到达苹果的位置。
/* ***********************************************
Author :yzkAccepted
Created Time :2016/3/25 20:55:41
TASK :ggfly.cpp
LANG :C++
************************************************ */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef __int64 ll;
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int h1,h2,a,b;
int day;
int dit;
scanf("%d%d",&h1,&h2);
scanf("%d%d",&a,&b);
dit=h2-h1;
int h=a-b;
day=0;
if(8*a>=dit)
{
printf("0\n");
}
else
{
if(a<=b)
{
printf("-1\n");
}
else
{
dit-=8*a;
dit+=12*b;
while(dit>0)
{
// printf("%d\n",dit);
day++;
dit-=12*a;
if(dit<=0)
break;
else
dit+=12*b;
}
printf("%d\n",day);
}
}
return 0;
}