Блог пользователя wjex09

Автор wjex09, история, 4 года назад, По-английски

Hi I'm unable to solve the following problem spoj problem . I've tried but can't deduce anything , any hints/ideas are welcome.

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

anyone?

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

I can suggest you the following strightforward approach:

  • derive or find the exact formula $$$S(n) = \Large \sum\limits_{d|n} \frac{n!}{d!\,(\frac{n}{d}!)^d}$$$
  • represent large numbers as its prime factorisation; i've used
struct component
{
  short cnt[1229];
};

where 1229 is the number of prime numbers till 10000 ($$$N_{max} \times K_{max}$$$) and cnt is the power of corresponding prime number in order to transform all multiplications and divisions to additions and substractions

  • use optimised bigint library for converting factoring numbers into digital form.
  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks for replying i finally understood how to derive the formula and got it accepted.