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

Разделы > Linear Data Structures: Arrays > задача:


50271 - Factorial

Гость
• Обсуждение задачи (1)

Задачи раздела

• 50445 - Cryptography
• 50410 - Zero Padding
• 50380 - Sum of the Numbers in the ...
• 50300 - Matrix
• 50611 - Максимум из минимумов
• 50616 - Змейка
• 50647 - Спираль
• Dhomat e hotelit
• 50271 - Factorial
• 50419 - The longest bitonic sequence
• 50326 - Matrix Operations
• 50329 - Draw Matrix-1
• 2 ->10
• 50592 - Shumezimi i Matricave
• 50606 - Длинное произведение
• 50607 - Длинная сумма
• 50319 - Toll Plazas

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Павел Кузнецов, ПГУ. Сложность Бета

For any positive integer N its factorial is defined in the following way:
N! = 1 · 2 · ... · N
Your task is to find K successive digits in a row in number N!, beginning from the first nonzero digit. See the examples for details.

Input
The first line of the input contains integers N and K (1 ≤ N ≤ 50000; 1 ≤ K ≤ 10).
Output
The output represents the answer to the question. The answer should have no spaces or other symbols except digits.

Input 1 Output 1
10 3
288
Comment: 10! = 3628800. The first nonzero digit is 8.
The three successive digits beginning with 8 are 288.
Input 2 Output 2
13 4
0208
Comment: 13! = 6227020800. The first nonzero digit is 8. The four
successive digits beginning with 8 are 0208. The leading 0 is obligatory!
Input 3 Output 3
5 10
12
Comment: 5! = 120. The first nonzero digit is 2. There are only two
successive digits beginning with 2, which is less than 10, so it is
necessary to write all of them without the leading zeros!

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

www.contester.ru