Sumac Sequences | 프로그래밍의 벗 PivotOJ
PivotOJ

Sumac Sequences

시간 제한: 2000ms메모리 제한: 512MB출처: CCC 2011 JuniorBOJ 6780

문제

In a sumac sequence, t1, t2, .., tm, each term is an integer greater than or equal 0. Also, each term, starting with the third, is the difference of the preceding two terms (that is, tn+2 = tn − tn+1 for n ≥ 1). The sequence terminates at tm if tm−1 < tm.

For example, if we have 120 and 71, then the sumac sequence generated is as follows:

120, 71, 49, 22, 27.

This is a sumac sequence of length 5.

입력

The input will be two positive numbers t1 and t2, with 0 < t2 < t1 < 10000.

출력

The output will be the length of the sumac sequence given by the starting numbers t1 and t2.

예제

예제 1

입력
120
71
출력
5
코드를 제출하려면 로그인하세요.