Trouble understanding solution for Digit DP problem

Правка en2, от glow, 2018-05-24 16:41:34

Hi, I am trying to solve a question. I understand the basic approach here using inclusion-exclusion principle but not able to understand what's happening in code at line 54 to 70. I understand that author of code is trying to place digits in empty places but why one loop(for i) starts from 0 and end at <dig_n-1 and why reverse after that(line 61) ? and similar kind of thing with j loop.

Problem editorial: here

Code take from here

Теги #combinatorics, #dp, #math

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский glow 2018-05-24 16:41:34 73
en1 Английский glow 2018-05-24 16:39:01 617 Initial revision (published)