ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1055. Сочетания

The algorithm for solving this problem. EASY TO UNDERSTAND !
For example :
N = 7 and M = 3
you see : 7!/(3!*4!) = (2*3*4*5*6*7)/(2*3*2*3*4) = (5*6*7)/(2*3) = 35
=> you need not to calculate the multiple but divide all numbers into prime
I assign : the left = (5*6*7), the right = (2*3)
after division the left :
5 = 5
6 = 2*3
7 = 7
you will count all prime, the result is following :
there are 1 primes with value of 2
there are 1 primes with value of 3
there are 1 primes with value of 5
there are 1 primes with value of 7
I put into the bracket (1,1,1,1)
after divison the right :
2 = 2
3 = 3
there are 1 primes with value of 2
there are 1 primes with value of 3
there are 0 primes with value of 5
there are 0 primes with value of 7
I put into the bracket (1,1,0,0)
the left - the right = (1,1,1,1) - (1,1,0,0) = (0,0,1,1)
and the result 0+0+1+1 = 2
2 is the result
GOOD LUCK !
Re: The algorithm for solving this problem. EASY TO UNDERSTAND !
Послано nguyenductam 5 апр 2010 08:52
Thank you ,but i don't think this is good algorithm. My opinion.