Codeforces712C【贪心】

看了这篇。。
http://blog.csdn.net/queuelovestack/article/details/52503162
直接就是从小到大,那么每次按最大的递增顺序上去,就是了。
因为每次只能取那么大,符合三角形三边关系,也不会避免每次拿小了。

#include <bits/stdc++.h>
using namespace std;
typedef __int64 LL;
const int N=3;
int s[N];
int main()
{
    int x,y,i;
    scanf("%d%d",&x,&y);
    s[0]=s[1]=s[2]=y;
    for(i=0;s[0]<x||s[1]<x||s[2]<x;i++)
        s[i%3]=s[(i+1)%3]+s[(i+2)%3]-1;//这个取膜处理三个关系对于本萌新来说也真是妙啊;
    printf("%d
",i);
    return 0;
}
原文地址:https://www.cnblogs.com/keyboarder-zsq/p/5934793.html