样例可以过,但测试点0分求帮助[哭]

P1464 Function

XZY1020932680 @ 2024-05-18 17:49:29

样例可以过,但测试点0分求帮助[哭]

using namespace std;

const int N=1E3+10;
long long f[21][21][21];

long long w(int a,int b,int c){
    if(a <= 0 || b <= 0 || c <= 0) return 1;//归 

    if(a > 20 || b > 20 || c > 20) return w(20, 20, 20);//递
    if(a,b&&b<c){
        if(!f[a][b][c=1])   f[a][b][c=1]  =w(a,b,c-1);
        if(!f[a][b-1][c-1]) f[a][b-1][c-1]=w(a,b-1,c-1);
        if(!f[a][b-1][c])   f[a][b-1][c]  =w(a,b-1,c);
        f[a][b][c]=f[a][b][c-1]+f[a][b-1][c-1]-f[a][b-1][c];
        return f[a][b][c];
    }
    if(!f[a-1][b][c])     f[a][b][c=1]     =w(a-1,b,c);
    if(!f[a-1][b-1][c])   f[a][b-1][c-1]   =w(a-1,b-1,c);
    if(!f[a-1][b][c-1])   f[a][b-1][c]     =w(a-1,b,c-1);
    if(!f[a-1][b-1][c-1]) f[a-1][b-1][c-1] =w(a-1,b-1,c-1);
    f[a][b][c]=f[a-1][b][c]+f[a-1][b-1][c]+f[a-1][b-1][c-1]-f[a-1][b-1][c-1];
    return f[a][b][c];
}

int main(){
    long long n,m,u;
    while(1){
        cin>>n>>m>>u;
        if(n==-1&&m==-1&&u==-1) break;
        cout<<"w("<<n<<", "<<m<<", "<<u<<") = "<<w(n,m,u)<<endl;
    }
    return 0;
}

by XZY1020932680 @ 2024-05-18 18:42:37

发错了呜呜呜```#include<bits/stdc++.h> using namespace std;

const int N=1E3+10; long long f[21][21][21];

long long w(long long a,long long b,long long c){ if(a <= 0 || b <= 0 || c <= 0) return 1;//归

if(a > 20 || b > 20 || c > 20) return w(20, 20, 20);//递
if(a,b&&b<c){
    if(!f[a][b][c-1])   f[a][b][c-1]  =w(a,b,c-1);
    if(!f[a][b-1][c-1]) f[a][b-1][c-1]=w(a,b-1,c-1);
    if(!f[a][b-1][c])   f[a][b-1][c]  =w(a,b-1,c);
    f[a][b][c]=f[a][b][c-1]+f[a][b-1][c-1]-f[a][b-1][c];
    return f[a][b][c];
}
if(!f[a-1][b][c])     f[a-1][b][c]     =w(a-1,b,c);
if(!f[a-1][b-1][c])   f[a-1][b-1][c]   =w(a-1,b-1,c);
if(!f[a-1][b][c-1])   f[a-1][b][c-1]   =w(a-1,b,c-1);
if(!f[a-1][b-1][c-1]) f[a-1][b-1][c-1] =w(a-1,b-1,c-1);
f[a][b][c]=f[a-1][b][c]+f[a-1][b-1][c]+f[a-1][b][c-1]-f[a-1][b-1][c-1];
return f[a][b][c];

}

int main(){ long long n,m,u; while(1){ cin>>n>>m>>u; if(n==-1&&m==-1&&u==-1) break; cout<<"w("<<n<<", "<<m<<", "<<u<<") = "<<w(n,m,u)<<endl; } return 0; }


by xzq1 @ 2024-05-21 11:00:42

你写成if(a,b&&b<c)了,把,改成<


|