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

7487번 - The Very Greatest Common Divisor 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB21215111374.834%

문제

You need to find greatest common divisor of two integers a and b. Each number a and b are determinants of the square matrix of the form:

\[\begin{pmatrix} 1 & 1 & 0 & \cdots & 0 \\ -1 & 1 & 1 & \ddots & \vdots \\ 0 & -1 & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & \ddots & 1 \\ 0 & \cdots & 0 & -1 & 1 \end{pmatrix}\]

입력

The first line of the input file contains number n < 250 of test cases. The description of a test case consists of two lines. The first line contains integer a (0 < a < 1012540), the second – integer b (0 < b < 1012540).

출력

For each test case print the greatest common divisor of integers a and b on a separate line.

제한

예제 입력 1

3
2
3
3
21
6765
610

예제 출력 1

1
3
5

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > All-Ukrainian Collegiate Programming Contest > AUCPC Semi-Final 2010 G번

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

출처

대학교 대회

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

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