ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Camp. Turkey > задача:


GCD of ones

Задачи сборника

• Nameplates
• Cycle detection
• Cities and roads
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Permutations
• Reverse permutation
• Divisors count
• GCD of ones
• Set cover problem
• Subsets
• The N Queens Problem
• Maximum Sum 2
• Gifts of Santa Claus
• Shopping
• Diameter of graph
• Corridor

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 1000/1000/1000/1000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

Given two natural numbers. First of them A consists of exactly N ones, second B of exactly M ones. Find their greatest common divisor.

Input

There are two integers N and M on the first line (0 < N, M ≤ 2000).

Output

Write greatest common divisor of A = 11...1 (N times) and B = 11...1 (M times).

Example

stdin stdout

1 1

1

1 2 1
Для отправки решений необходимо выполнить вход.

www.contester.ru