#P2152. [SDOI2009] SuperGCD

    ID: 1130 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>高精度2009各省省选山东O2优化最大公约数,gcd

[SDOI2009] SuperGCD

Description

Sheng bill has amazing mental arithmetic skills and can even compute the greatest common divisor of two huge numbers in his head. Therefore, he often competes with others in computing the greatest common divisor. One day, Sheng bill arrogantly challenged you, but losing to Sheng bill would be embarrassing. So you decide to write a program to teach him a lesson.

Input Format

Two lines: the first line contains an integer aa, and the second line contains an integer bb.

Output Format

One line, representing the greatest common divisor of aa and bb.

12
54
6

Hint

Constraints

  • For 20%20\% of the testdata, 0<a,b10180<a,b\le 10^{18}.
  • For 100%100\% of the testdata, 0<a,b10100000<a,b\le 10^{10000}.

Translated by ChatGPT 5