【容斥+組合數】Massage @2018acm徐州邀請賽 E
阿新 • • 發佈:2018-12-24
JSZKC feels so bored in the classroom that he wants to send massages to his girl friend. However, he can’t move to his girl friend by himself. So he has to ask his classmates for help.
The classroom is a table of size N × M. We'll consider the table rows numbered from top to bottom 1 through N, and the columns numbered from left to right 1 through M. Then we'll denote the cell in row x and column y as (x, y). And every cell sits a student.
Initially JSZKC sits on the cell (1, 1) . And his girl friend sits on cell (n, m). A message can go from cell (x, y) to one of two cells (x + 1, y) and (x, y + 1). JSZKC doesn’t want to trouble his classmates too much. So his classmates(not including his girl friend) may not take massages more than once. It’s obvious that he can only send out two massages. Please help JSZKC find the number of ways in which the two massages can go from cell (1, 1) to cell (n, m).
More formally, find the number of pairs of non-intersecting ways from cell (1, 1) to cell (n, m) modulo 1000000007 . Two ways are called non-intersecting if they have exactly two common points — the starting point and the final point.
The classroom is a table of size N × M. We'll consider the table rows numbered from top to bottom 1 through N, and the columns numbered from left to right 1 through M. Then we'll denote the cell in row x and column y as (x, y). And every cell sits a student.
Initially JSZKC sits on the cell (1, 1) . And his girl friend sits on cell (n, m). A message can go from cell (x, y) to one of two cells (x + 1, y) and (x, y + 1). JSZKC doesn’t want to trouble his classmates too much. So his classmates(not including his girl friend) may not take massages more than once. It’s obvious that he can only send out two massages. Please help JSZKC find the number of ways in which the two massages can go from cell (1, 1) to cell (n, m).
More formally, find the number of pairs of non-intersecting ways from cell (1, 1) to cell (n, m) modulo 1000000007 . Two ways are called non-intersecting if they have exactly two common points — the starting point and the final point.