CodeForces 652A Gabriel and Caterpillar

Posted Fighting Heart

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CodeForces 652A Gabriel and Caterpillar相关的知识,希望对你有一定的参考价值。

简单模拟。

#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的主要内容,如果未能解决你的问题,请参考以下文章

XML 加载的 AS3 问题

Neural Tangent Kernel (NTK)

codeforces#341

codeforces Codeforces 650A Watchmen

codeforces-115A-Party

[2016-03-23][codeforces][208][A][Dubstep]