CodeForces 664A Complicated GCD

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lizhaowei213/article/details/51172603
Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u

 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

 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;
}



猜你喜欢

转载自blog.csdn.net/lizhaowei213/article/details/51172603