Anyone please elaborate the problem. Thanks in Advance.

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

1 | tourist | 3509 |

2 | OO0OOO00O0OOO0O0…O | 3327 |

3 | Um_nik | 3297 |

4 | Syloviaely | 3274 |

5 | LHiC | 3216 |

6 | Petr | 3161 |

7 | Benq | 3130 |

8 | ko_osaga | 3124 |

9 | Swistakk | 3089 |

10 | dotorya | 3060 |

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

1 | Radewoosh | 185 |

2 | rng_58 | 161 |

3 | tourist | 158 |

4 | Petr | 153 |

5 | Swistakk | 150 |

5 | Vovuh | 150 |

7 | csacademy | 147 |

8 | Errichto | 146 |

9 | Um_nik | 145 |

9 | PikMike | 145 |

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: Sep/18/2018 23:29:18 (d2).

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.