Anyone please elaborate the problem. Thanks in Advance.

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

1 | tourist | 3496 |

2 | moejy0viiiiiv | 3288 |

3 | W4yneb0t | 3218 |

4 | TakanashiRikka | 3178 |

5 | Petr | 3173 |

6 | izrak | 3109 |

6 | Um_nik | 3109 |

8 | anta | 3106 |

9 | ershov.stanislav | 3105 |

10 | dotorya | 3089 |

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

1 | rng_58 | 173 |

2 | csacademy | 169 |

3 | Swistakk | 158 |

4 | Petr | 157 |

4 | tourist | 157 |

6 | Errichto | 151 |

7 | Zlobober | 145 |

8 | matthew99 | 141 |

9 | Endagorion | 137 |

10 | BledDest | 136 |

Anyone please elaborate the problem. Thanks in Advance.

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/11/2017 16:14:41 (c4).

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.