Complicated GCD

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏 | 已有3人收藏了本题
Problem 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.

SampleInput 1
1 2
SampleOutput 1
1
SampleInput 2
61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576
SampleOutput 2
61803398874989484820458683436563811772030917980576
Submit
题目统计信息详细
总AC数26
通过人数23
尝试人数24
总提交量33
AC率69.70%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: