Anyone please elaborate the problem. Thanks in Advance.

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

1 | tourist | 3434 |

2 | Petr | 3353 |

3 | OO0OOO00O0OOO0O0…O | 3314 |

4 | fateice | 3306 |

5 | Um_nik | 3286 |

6 | Syloviaely | 3274 |

7 | dotorya | 3145 |

8 | LHiC | 3114 |

9 | Radewoosh | 3098 |

10 | mnbvmar | 3096 |

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

1 | tourist | 178 |

2 | rng_58 | 166 |

3 | Petr | 156 |

4 | csacademy | 155 |

5 | Swistakk | 149 |

5 | lewin | 149 |

7 | Um_nik | 142 |

8 | Errichto | 141 |

9 | matthew99 | 138 |

10 | PikMike | 136 |

10 | ko_osaga | 136 |

10 | GreenGrape | 136 |

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: Jun/20/2018 08:46:34 (d1).

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.