303427: CF664A. Complicated GCD
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Complicated GCD
题意翻译
【问题描述】 给你若干个整数,它们是a,a+1,a+2,…,b,请求出它们的最大公约数,即 gcd(a, a+1, a+2, …, b)。 【输入格式】 一行,包含两个整数a和 b(1<=a<=b<=10^100)。 【输出格式】 一个整数,表示从a到b所有整数的最大公约数。 【输入样例1】 1 2 【输出样例1】 1 【输入样例2】 61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576 【输出样例2】 61803398874989484820458683436563811772030917980576题目描述
Greatest common divisor $ GCD(a,b) $ of two positive integers $ a $ and $ b $ is equal to the biggest integer $ d $ such that both integers $ a $ and $ b $ are divisible by $ d $ . There are many efficient algorithms to find greatest common divisor $ GCD(a,b) $ , for example, Euclid algorithm. Formally, find the biggest integer $ d $ , such that all integers $ a,a+1,a+2,...,b $ are divisible by $ d $ . To make the problem even more complicated we allow $ a $ and $ b $ to be up to googol, $ 10^{100} $ — such number do not fit even in 64-bit integer type!输入输出格式
输入格式
The only line of the input contains two integers $ a $ and $ b $ ( $ 1<=a<=b<=10^{100} $ ).
输出格式
Output one integer — greatest common divisor of all integers from $ a $ to $ b $ inclusive.
输入输出样例
输入样例 #1
1 2
输出样例 #1
1
输入样例 #2
61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576
输出样例 #2
61803398874989484820458683436563811772030917980576