Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
A positive integer ~p~ is called the greatest common divisor (GCD) of ~n~ and ~m~ if ~m~ and ~n~ are both divisible by ~p~ and ~p~ is the largest such number.
Write a program to input two positive integers ~n~ and ~m~ (~n, m \leq 10^{18}~).
Print the greatest common divisor of ~n~ and ~m~.
Input:
- Input two positive integers ~n~ and ~m~ in two lines.
Output:
- Print the greatest common divisor of ~n~ and ~m~.
Sample Input
12
15
Sample Output
3
Bình luận