Here is the problem link UVA Live 6844

Contest is running

Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)

01:42:34

Register now »

Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)

01:42:34

Register now »

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

1 | tourist | 3645 |

2 | Radewoosh | 3403 |

3 | Um_nik | 3348 |

4 | LHiC | 3336 |

5 | Benq | 3316 |

6 | V--o_o--V | 3275 |

7 | mnbvmar | 3241 |

8 | yutaka1999 | 3190 |

9 | ainta | 3180 |

10 | Petr | 3106 |

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

1 | Errichto | 191 |

2 | Radewoosh | 176 |

3 | PikMike | 165 |

4 | rng_58 | 164 |

5 | Vovuh | 160 |

6 | majk | 158 |

7 | antontrygubO_o | 154 |

7 | 300iq | 154 |

9 | Um_nik | 151 |

10 | kostka | 149 |

Here is the problem link UVA Live 6844

↑

↓

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/25/2019 17:52:27 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

http://www.voidcn.com/article/p-vljjarbk-sw.html

The explanation is in Chinese. You can read the code though...

Sorry, but I need the logic , not the solution. :)

I don't recommend it but you could use Google Translate. The translated explanation is understandable enough.

If you are dealing with binomial coefficients at first always think of how Pascals triangle might help you. The problem basically wants to find quantity of odd numbers in some region of pascals triangle. The region is a trapezoid cut with two horizontal lines.

Next idea is that, when you want to calculate something for interval

[low, high], calculate if for[1,high]and[1,low-1]then subtract and get the result for[low, high].This trick works because it is easier to deal when the left endpoint of your interval is 1.Now we need a function

f(n)which returns the number of odd entries in firstnrows of pascal's triangle. In fact, the following is true: The number of odd entries in rowNof Pascal's Triangle is2raised to the number of1's in the binary expansion ofN. Example: Since83 = 64 + 16 + 2 + 1has binary expansion(1010011), then row83has2^4 = 16odd numbers.Hope these ideas will help you in solving this problem. If something is still unclear let me know.

Thank you

Go to this link and under the Rows you will see:

Parity: To count odd terms in row n (in pascal triangle), convert n to binary. Let x be the number of 1s in the binary representation. Then the number of odd terms will be $$$2^x$$$. These numbers are the values in Gould's sequence.[20]

So, how we can calculate this within a huge $$$10^{11}$$$ range. Use Digit DP. See this link for this kind of problems.