I need help to solved this intersting problem link .

thank you in advance.

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

1 | tourist | 3581 |

2 | OO0OOO00O0OOO0O0…O | 3327 |

3 | Petr | 3161 |

4 | LHiC | 3158 |

5 | CongLingDanPaiSh…5 | 3116 |

6 | ko_osaga | 3115 |

7 | mnbvmar | 3111 |

8 | Um_nik | 3104 |

9 | Benq | 3098 |

10 | Swistakk | 3089 |

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

1 | Radewoosh | 185 |

2 | Errichto | 162 |

3 | rng_58 | 161 |

4 | tourist | 158 |

5 | Vovuh | 150 |

5 | Um_nik | 150 |

7 | Petr | 149 |

7 | Swistakk | 149 |

9 | 300iq | 148 |

9 | PikMike | 148 |

I need help to solved this intersting problem link .

thank you in advance.

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/15/2018 12:52:06 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

if you now know how to solve it then please help .

not sure at all but this might work:

First, let's work on finding the # of cool numbers <= X, for a given X (then we can get the answer by computing that for B and A-1).

For a fixed X, we can get the # of cool numbers with a dp[digit][sum1][sum2][alreadyless_bit]

digit will be the position of the digit we're trying, We will go from most significative to least. sum1 and sum2 are the sums of the two sets. alreadyless_bit tells if we are already strictly less than X, if so, the new digit can be any digit, otherwise, it has to be between 0 and the respective X's digit.

This counts the cool numbers but it might count each one many times, I don't know if you can avoid that hehe