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

Автор Upgrading....., история, 6 лет назад, По-английски

UVA 11762

Suppose we want to calculate E(N) where N is a number,k is the number of it’s distinct prime factors and p is the number of primes < n

Normal rule, E(N)=(1/p)*(1 + E(N/a1) + E(N/a2) + E(N/a3) … + E(N/ak)) + ((p-k)/p)*(1 + E(N))

What is the wrong about this logic?

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

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

The problem statement also counts "blanks" as a move. Even if you whiff, get an invalid prime, and remain at D, it still adds 1 to the tally because it still counts as a move.

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

    it still adds 1 to the tally because it still counts as a move. don't understand this part.....

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

    the first 1 is for blank move? so, why not another 1 for invalid prime?

    • »
      »
      »
      6 лет назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      Let's look at a simpler problem. How many coins do you have to flip on average to get 2 Heads in a row?

      For this we define E(n) being "expected number of flips if I already have n heads". Obviously E(2) = 0 and we just want E(0).

      How do we compute E(0)? There is a 50% chance that we get tails, so that is still E(0) but  + 1 because we still flipped the coin. There is a 50% chance that we get heads, so that is E(1) and also  + 1 because we also flipped the coin. So that is , and notice if you distribute the fractions everything becomes +1 in the end.

      So to answer your question, yes you put the +1 for invalid prime AND for valid prime. But you put the +1 inside the parenthesis, and the gets multiplied and distributed. The +1 is outside the parenthesis.

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

        Understand Perfectly...Can you give some resource to learn Expected Value effectively?

        • »
          »
          »
          »
          »
          6 лет назад, # ^ |
            Проголосовать: нравится +1 Проголосовать: не нравится

          Sorry, I didn't learn Expected Value from one particular source :((

          I just picked it up after doing enough Math and Programming problems. You can probably search Codeforces for the Probability tag.

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

Auto comment: topic has been updated by Upgrading..... (previous revision, new revision, compare).

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

Auto comment: topic has been updated by Upgrading..... (previous revision, new revision, compare).

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

Auto comment: topic has been updated by Upgrading..... (previous revision, new revision, compare).