9 条题解

  • -1
    @ 2023-5-3 9:16:35

    #include<bits/stdc++.h> long long a,b,f[31][31],c,d,k[31][31]; using namespace std; int main(){ cin>>a>>b>>c>>d; k[c][d]=1; if(c+2<=a&&d-1>=0) k[c+2][d-1]=1; if(c+2<=a&&d+1<=b) k[c+2][d+1]=1; if(c-2>=0&&d+1<=b) k[c-2][d+1]=1; if(c-2>=0&&d-1>=0) k[c-2][d-1]=1; if(c+1<=a&&d-2>=0) k[c+1][d-2]=1; if(c+1<=a&&d+2<=b) k[c+1][d+2]=1; if(c-1>=0&&d-2>=0) k[c-1][d-2]=1; if(c-1>=0&&d+2<=b) k[c-1][d+2]=1; for(int i=0;i<=a;i++){ if(k[i][0]==1) break; else f[i][0]=1; } for(int j=0;j<=b;j++){ if(k[0][j]==1) break; else f[0][j]=1; } for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ if(k[i][j]==1) f[i][j]==0; else f[i][j]=f[i-1][j]+f[i][j-1]; }

    }
    	
    cout<<f[a][b]<<endl;
    
    return 0;
    

    }

    • ~就是简单嘛~ *

    信息

    ID
    224
    时间
    1000ms
    内存
    16MiB
    难度
    5
    标签
    递交数
    102
    已通过
    40
    上传者