如果你DP的初始化是 f[1][i]=if[1][i]=if[1][i]=i,注意有可能 n=1,mod≤mn=1,mod \le mn=1,mod≤m,因此需要写成 f[1][i]=i%modf[1][i]=i\%modf[1][i]=i%mod。