in problem 27E you are asked to find the smallest positive integer which has exactly n divisors .

how to solve it > >

Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | Radewoosh | 3443 |

2 | tourist | 3372 |

3 | OO0OOO00O0OOO0O0…O | 3264 |

4 | ksun48 | 3176 |

5 | scott_wu | 3168 |

6 | CongLingDanPaiSh…5 | 3157 |

7 | Benq | 3154 |

8 | Petr | 3139 |

9 | Um_nik | 3138 |

10 | LHiC | 3118 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 195 |

2 | Errichto | 176 |

3 | rng_58 | 158 |

4 | Ashishgup | 157 |

5 | neal | 156 |

6 | tourist | 154 |

7 | Petr | 151 |

8 | PikMike | 150 |

9 | Um_nik | 149 |

10 | kostka | 147 |

10 | Swistakk | 147 |

10 | Vovuh | 147 |

in problem 27E you are asked to find the smallest positive integer which has exactly n divisors .

how to solve it > >

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/12/2018 23:18:45 (d1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

We denote the number of divisors of a number

x, asd(x). It can be proven thatd(x) = (e_{1}+ 1)·(e_{2}+ 1)·...·(e_{k}+ 1) , wherex=p_{1}^{e1}·p_{2}^{e2}·...·p_{k}^{ek}is the prime factorization ofx.We notice that it's optimal for

p_{1}to be as small as it can be, so it should be equal to 2. We notice the same forp_{2}, so it should be equal to 3. It is optimal to take the smallest possible prime every time. So we should only take the firstkprimes. But consider the case wheree_{i}= 1i. We see that if we take more thanp_{k}= 41 (approximately), we are way over our limit of 10^{18}for our answer. So our list of primes should be up to 41.Now we try to construct the desired number by some kind of trial-and-error. As long as we can multiply our current number with the current prime raised to some power

e_{i}, we test for this situation, going to the next prime, knowing the current number's divisors and its value. Notice that every prime should not fit more than times in some numberX, and we only have about 15 primes, so operations aren't too much.Solution link: 43224863

thanks.. charis .. i got it...

trying every possibility in brute force way to get the minimum number...

ur solution is very clear... :))

You can bring down the operations even more, considering the fact that e(i)>=e(i+1) in the optimal solution.

Yes, you are right. Holding an extra parameter for

e_{i - 1}and startinge_{i}from there instead of 1. I believe you can also use dp on this idea if you modify it a little, but I don't think it's necessary.