I can't understand the line that covered by red. also can someone tell me the formula's name or it's proof.

Thanks for any future comments :)

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

1 | MiFaFaOvO | 3681 |

2 | Um_nik | 3553 |

3 | tourist | 3515 |

4 | Benq | 3508 |

5 | ecnerwala | 3390 |

6 | TLE | 3223 |

7 | scott_wu | 3209 |

8 | Petr | 3205 |

9 | ksun48 | 3197 |

10 | Radewoosh | 3188 |

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

1 | Errichto | 204 |

2 | antontrygubO_o | 189 |

2 | pikmike | 189 |

4 | Monogon | 186 |

5 | vovuh | 184 |

6 | Ashishgup | 182 |

7 | Um_nik | 180 |

8 | SecondThread | 174 |

9 | Radewoosh | 172 |

10 | ko_osaga | 161 |

I can't understand the line that covered by red. also can someone tell me the formula's name or it's proof.

Thanks for any future comments :)

↑

↓

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/14/2020 23:31:38 (f3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

I can't delete this comment...

https://nrich.maths.org/2478

You can find the formula in a manner similar to proving

`1+2+3+4+..+n = n*(n+1)/2`

Thanks

This is an arithmetic series. usually you can evaluate sequences x, x+d, x+2d, ... x+(n-1)*d by using the fact that x + x+(n-1)*d (simply pairing up the first and nth terms) equals x+d + x+(n-2)*d, + etc so basically you can just find the average of each element, which is (x+x+(n-1)*d) /2 * number of terms

Thanks

Hope it helps!

In second line when we take (b-a+1) as common factor isn't it look like that (b-a+1)*(a+b-a)/2 ? how does it become (a+b)

Ah it's clear now Thanks