您的位置:首页 > 其它

CodeForces 664A Complicated GCD

2016-04-17 12:12 447 查看
Complicated GCD

Time Limit: 1000MSMemory Limit: 262144KB64bit IO Format: %I64d & %I64u
Submit Status

Description

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, 10100 — such number do not fit even in 64-bit integer type!

Input

The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 10100).

Output

Output one integer — greatest common divisor of all integers from a to b inclusive.

Sample Input

Input
1 2


Output
1


Input
61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576


Output
61803398874989484820458683436563811772030917980576


Source

Codeforces Round #347 (Div. 2)
Submit Status

Problem descriptions:

System Crawler 2016-04-17

0






Initialization.




如果a==b,答案就是a或者b

如果a!=b,答案只能是1
#include <stdio.h>
#include <string.h>
const int MAXN=105;
char a[MAXN],b[MAXN];
int main()
{
while(scanf("%s%s",a,b)>0)
{
if(!strcmp(a,b))
printf("%s\n",a);
else
printf("1\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: