2018 Java Chapter 5 (Week 05)

From: 2018-09-01 00:00:00 To: 2018-11-13 00:00:00 Now: 2024-11-21 21:53:58 Status: Public

B - GCD

Time Limit: 1s Memory Limit: 128MB

Submissions: 777 Solved: 543
Description

두 정수 n1과 n2를 입력받아 최대공약수(greatest common divisor)를 구하는 프로그램을 작성하세요.

Write a program that find the greatest common divisor of two integers n1 and n2

 

Input

* Line 1 : 테스트케이스 T (1~1,000)

* Line 2 ~ T+1 : n1 n2

 - n1과 n2는 1~1,000 범위의 정수

 

Output

* Line 1 ~ T : GCD

 

Sample Input
4
2 3
2 4
67 203
638 932
Sample Output
1
2
1
2
Source

JAVA2015 PE5.14