拿到题一看,诶?怎么真难 写完一交,唉!还是挺困难简单

#include<bits/stdc++.h>
using namespace std;
int s[100][100][100]={};
int fxccf(int a,int b,int c){
    if(a<=0||b<=0||c<=0){
        return 1;
    }else if(a>20||b>20||c>20){
        return fxccf(20,20,20);
    }else if(a<b&&b<c){
        if(s[a][b][c]!=-9999){
            return s[a][b][c];
        }else{
            int t = fxccf(a,b,c-1)+fxccf(a,b-1,c-1)-fxccf(a,b-1,c);
            s[a][b][c]=t;
            return t;
        }
    }else{
        if(s[a][b][c]!=-9999){
            return s[a][b][c];
        }else{
            int t= fxccf(a-1,b,c)+fxccf(a-1,b-1,c)+fxccf(a-1,b,c-1)-fxccf(a-1,b-1,c-1);
            s[a][b][c]=t;
            return t;
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    for(int i=0;i<100;i++){
        for(int j=0;j<100;j++){
            for(int k=0;k<100;k++){
                s[i][j][k]=-9999;
            }
        }
    }
    while(true){
        int a,b,c;
        cin>>a>>b>>c;
        if(a==-1&&b==-1&&c==-1){
            break;
        }else{
            cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<fxccf(a,b,c)<<endl;
        }
    }
    return 0;
}

这道题是递归?

当我一看, 算了,拿个部分分得了! 做出来之后,我:huh? 不是哥们100容量也随便过吗?你的10^5的数据呢? 其实要是我想开大点也行,而你,我的数据,是真的fw

1 条评论

  • 1