PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000010. Ước chung lớn nhất của cả đoạn (Complicated GCD)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Ước chung lớn nhất của cả đoạn (Complicated GCD)
Complicated GCD
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive decimal integers that may be extremely large, find the greatest common divisor of every integer in the inclusive range . The values can exceed 64-bit integer capacity.
Input
One line contains decimal integers .
Output
Print the GCD of the entire interval.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
1 2
Output
1
Explanation
The interval contains consecutive integers , whose GCD is .