萌新?初学oi?
再见。
by Sai0511 @ 2020-01-20 21:42:08
@[connect](/user/114320) 草
真的是萌新刚学OI啊
by 引领天下 @ 2020-01-20 21:47:33
刚学OI就A了1.2k
by Sophon @ 2020-01-20 22:02:05
~~%萌新~~
by pocafup @ 2020-01-21 05:43:31
@[引领天下](/user/39863) 这里模数应该是 `k+1`(qwq
by 木木! @ 2020-01-21 20:03:32
楼上正解
by lytqwq @ 2020-01-21 20:13:28
@[木木!](/user/49458) 还是锅了?
```cpp
#include <bits/stdc++.h>
#define min(x,y) ((y)^(((x)^(y))&(-((x)<(y)))))
#define max(x,y) ((x)^(((x)^(y))&(-((x)<(y)))))
using namespace std;
int n,m,k,a[803][803],f[803][803][18][3],ans;
const int mod=1000000007;
int main(){
#ifndef ONLINE_JUDGE
//#define FILE_OUTPUT
#ifdef FILE_OUTPUT
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
long long c1=clock();
#endif
scanf("%d%d%d",&n,&m,&k);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)scanf("%d",&a[i]),f[i][j][a[i][j]][0]=1;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
for (int h=0;h<=k;h++){
f[i][j][h][1]=(f[i][j][h][1]+f[i-1][j][(h+a[i][j])%(k+1)][0])%mod;
f[i][j][h][1]=(f[i][j][h][1]+f[i][j-1][(h+a[i][j])%(k+1)][0])%mod;
f[i][j][h][0]=(f[i][j][h][0]+f[i-1][j][(h+(k+1)-a[i][j])%(k+1)][1])%mod;
f[i][j][h][0]=(f[i][j][h][0]+f[i][j-1][(h+(k+1)-a[i][j])%(k+1)][1])%mod;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)ans=(ans+f[i][j][0][1])%mod;
printf("%d",ans);
#ifndef ONLINE_JUDGE
#ifndef FILE_OUTPUT
puts("\n--------------------------------");
printf("Process exited after %g seconds with return value 0\n",(clock()-c1)/1000.0);
system("pause");
#endif
#endif
return 0;
}
```
by 引领天下 @ 2020-01-21 20:50:44