Logo
(追記) (追記ここまで)

6780번 - Sumac Sequences 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB73951548270.160%

문제

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

예제 출력 1

5

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2011 > CCC 2011 Junior Division 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /