Anyone please elaborate the problem. Thanks in Advance.

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

1 | tourist | 3496 |

2 | Um_nik | 3337 |

3 | Petr | 3298 |

4 | W4yneb0t | 3218 |

5 | Radewoosh | 3216 |

6 | OO0OOO00O0OOO0O0…O | 3188 |

7 | Syloviaely | 3168 |

8 | izrak | 3109 |

9 | anta | 3106 |

10 | fateice | 3099 |

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

1 | tourist | 184 |

2 | rng_58 | 170 |

3 | csacademy | 165 |

4 | Petr | 158 |

5 | Swistakk | 154 |

6 | lewin | 149 |

7 | Errichto | 147 |

8 | matthew99 | 145 |

9 | Zlobober | 141 |

9 | adamant | 141 |

Anyone please elaborate the problem. Thanks in Advance.

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/20/2018 06:58:05 (d3).

Desktop version, switch to mobile version.

User lists

Name |
---|

Let's solve the problem for each prime factor

pseparately.Suppose LCM of two numbers

iandjhasp^{e}in its factorization, then at least one of them must havep^{e}in its factorization as well. There are (e+ 1)^{2}-e^{2}ways to choose the exponents ofpso that one of the numbers has exponenteand the other one has exponent at moste.First let's make a list of primes with a sieve, then solve the problem for each prime factor as explained above. The results have to be multiplied because each prime factor is independent.

We'll be counting all pairs twice, except the case when

i=j(whennis a perfect square), so if the answer calculated isresthen will do the trick.