AtCoder Beginner Contest 120
B
K-th Common Divisor
AtCoder
⌀ 0
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given positive integers $A$ and $B$.

翻译中…

Find the $K$-th largest positive integer that divides both $A$ and $B$.

翻译中…

The input guarantees that there exists such a number.

翻译中…

Constraints

翻译中…
  • All values in input are integers.
  • $1 \leq A, B \leq 100$
  • The $K$-th largest positive integer that divides both $A$ and $B$ exists.
  • $K \geq 1$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

A B K

翻译中…

Output

翻译中…

Print the $K$-th largest positive integer that divides both $A$ and $B$.

翻译中…

样例

Input #1
8 12 2
Output #1
2
Three positive integers divides both $8$ and $12$: $1, 2$ and $4$. Among them, the second largest is $2$.
Input #2
100 50 4
Output #2
5
Input #3
1 1 1
Output #3
1
题目信息
题号
abc120_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。