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

10083번 - Strategy 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 16 MB3112956.250%

문제

During the World Cup 2014 qualifications, Serbia national football team had an interesting strategy. They were starting each attack by passing the ball from the player with the number N1 to the player with the number N2. Each following pass was to the player whose number equals the absolute value of the difference between the numbers of the two players previously having the ball. More formally, after the player Ni-2 passes the ball to the player Ni-1, the next player to receive the ball is the player Ni = |Ni-2 – Ni-1|.

This strategy, surprisingly, did not prove itself to be a useful one. Nevertheless, it made fans ponder who will be the K-th player to get the ball, given that the attack actually lasts long enough.

입력

The single line of input contains three non-negative integers, N1, N2, and K.

출력

The single line of output should contain the number Nk.

제한

  • 0 ≤ N1, N2 < 263
  • 1 ≤ K < 263

예제 입력 1

37 16 8

예제 출력 1

6

예제 입력 2

17254968996716914 5030751795369479754 2731091466

예제 출력 2

2019640987948

힌트

The players received the ball in the following order:

37, 16, 21, 5, 16, 11, 5, 6, 1, 5, 4, 1, 3, 2, 1, 1, 0, 1, 1, 0, …

The eight player to receive the ball is the player with the number 6.

출처

Olympiad > Balkan Olympiad in Informatics > Junior Balkan Olympiad in Informatics > JBOI 2014 3번

  • 데이터를 추가한 사람: doju
(追記) (追記ここまで)

출처

대학교 대회

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

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