kkk people are wandering in the city from 000 second to the TTT-th second. They are numbered from 111 to kkk. The city can be viewed as a n×mntimes mn×m grid, and the top left square is (1,1)(1,1)(1,1). The iii-th person is standing at square at first. For each second, every person will move to an adjacent square. Two squares are adjacent if and only if they share a common edge. In each jjj-th second , the iii-th person's move can be described as a character di,jd_{i,j}di,j. Let (x,y)(x,y)(x,y) be the current square of this person in the jjj-th second, and be the position where he/she will appear in the (j+1)(j+1)(j+1)-th second, then: ={ifdi,j=Lifdi,j=Rifdi,j=Uifdi,j=D
kkk people are wandering in the city from 000 second to the TTT-th second. They are numbered from 111 to kkk. The city can be viewed as a n×mntimes mn×m grid, and the top left square is (1,1)(1,1)(1,1). The iii-th person is standing at square (xi,yi)(x_i,y_i)(xi,yi) at first. For each second, every person will move to an adjacent square. Two squares are adjacent if and only if they share a common edge. In each jjj-th second (j=0,1,⋯ ,T−1j= 0,1,cdots,T-1j=0,1,⋯,T−1), the iii-th person's move can be described as a character di,jd_{i,j}di,j. Let (x,y)(x,y)(x,y) be the current square of this person in the jjj-th second, and (x′,y′)(x',y')(x′,y′) be the position where he/she will appear in the (j+1)(j+1)(j+1)-th second, then: (x′,y′)={(x,y−1) if di,j=L(x,y+1) if di,j=R(x−1,y) if di,j=U(x+1,y) if di,j=D
(x',y')=begin{cases}
(x,y-1) & text{ if } d_{i,j}=text{L} \
(x,y+1) & text{ if } d_{i,j}=text{R} \
(x-1,y) & text{ if } d_{i,j}=text{U} \
(x+1,y) & text{ if } d_{i,j}=text{D}
end{cases}(x′,y′)=⎩⎪⎪⎪⎨⎪⎪⎪⎧(x,y−1)(x,y+1)(x−1,y)(x+1,y) if di,j=L if di,j=R if di,j=U if di,j=D Define WtW_tWt as the number of different pairs (i,j)(i,j)(i,j) such that i
标签: HBC237455抽卡
逆元
数学
概率期望
数论Counting题解