In this winter holiday, Bob has a plan for skiing at the mountain resort. This ski resort has MM different ski paths and NN different flags situated at those turning points. The ii-th path from the
组合数学-大组合数取模(Lucas定理) 题意: 将不超过m颗的相同的豆子放在n棵不同的树上,每棵树可以为空,求方案数mod p (1 <= n, m <= 1000000000, 1 < p < 100000,p是质数) 分析: 可以理解为有m颗豆子,在n棵树上放k颗,然后再加一棵树,放m-k颗,于是变成了m颗相同的豆子放在n+1棵不同树上的方案数。 也就是求
import java.util.*;public class Main { static int max,sum;static int h[][]=new int[1002][1002];//static int a[][]=new int[1002][1002];//这个打算打表优化的,AC了就没用上。static void dfs(int h[][],int i,int