欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

codeforces 712 Memory and De-Evolution

程序员文章站 2022-06-19 18:26:09
2019-05-19 13:25:37 加油,加油,坚持,坚持!!! 一定要逆推,才可以是最少的次数 更好的方法: https://www.cnblogs.com/ECJTUACM-873284962/p/6379014.html ......

2019-05-19

13:25:37

加油,加油,坚持,坚持!!!

一定要逆推,才可以是最少的次数

更好的方法:

https://www.cnblogs.com/ecjtuacm-873284962/p/6379014.html

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll x, y;
    
    scanf("%lld %lld", &x, &y);
    ll maxx = y;
    ll midd = y;
    ll minn = y;
    ll p = 0;
    ll q = 0;
    ll count = 0;
    while(1)
    {
        p = maxx;
        q = midd;
        maxx = midd + maxx - 1;
        midd = p;
        minn = q;
        count++;
        if (maxx >= x)
        {
            cout << count + 2 << endl;
            return 0;
        }
    }    
    return 0;
}