「木」迷雾森林

https://ac.nowcoder.com/acm/problem/53675

 

为什么加上mod2333就对了?

#include <bits/stdc++.h>
using namespace std;
int a[3005][3005],dp[3005][3005];

template<class T>inline void read(T &res){
    char c;T flag=1;
    while((c=getchar())<'0'||c>'9')
        if(c=='-')flag=-1;res=c-'0';
    while((c=getchar())>='0'&&c<='9')
        res=res*10+c-'0';res*=flag;
}

int main(){
    int m,n;read(m),read(n);
    for(int i=1;i<=m;i++)
        for(int j=1;j<=n;j++)
            read(a[i][j]);
    for(int i=m;i>=1;i--)
        for(int j=1;j<=n;j++){
            if(!a[i][j])
                dp[i][j]=dp[i+1][j]+dp[i][j-1];
            if(i==m&&j==1)
                dp[i][j]=1;
            //cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
            dp[i][j]%=2333;//啊这
        }
    cout<<dp[1][n]%2333<<endl;
    return 0;
}

 

posted @ 2020-09-12 15:50  asunayi  阅读(126)  评论(0)    收藏  举报