100分,但subtask#2还是RE了怎么回事

P1464 Function

jango @ 2024-03-29 00:23:52

#include<stdio.h>
int note[21][21][21]={0};
long funw(long long a,long long b,long long c)
{
    if(a<=0||b<=0||c<=0)
    {
        return 1;
    }
    else if(a>20||b>20||c>20)
    {
        return funw(20,20,20);
    }
    else if(a<b&&b<c)
    {
        if(note[a][b][c]==0)
        {
            note[a][b][c]=funw(a,b,c-1)+funw(a,b-1,c-1)-funw(a,b-1,c);
        }
        return note[a][b][c];
    }
    else
    {
        if(note[a][b][c]==0)
        {
            note[a][b][c]=funw(a-1,b,c)+funw(a-1,b-1,c)+funw(a-1,b,c-1)-funw(a-1,b-1,c-1);
        }
        return note[a][b][c];
    }
}
int main()
{
    long long inp[100][3]={0},n;
    for(int i=0;;i++)
    {
        scanf("%lld %lld %lld",&inp[i][0],&inp[i][1],&inp[i][2]);
        if(inp[i][0]==-1&&inp[i][1]==-1&&inp[i][2]==-1)
        {
            n=i;
            break;
        }
    }
    for(int i=0;i<n;i++)
    {
        printf("w(%lld, %lld, %lld) = %lld\n",inp[i][0],inp[i][1],inp[i][2],funw(inp[i][0],inp[i][1],inp[i][2]));
    }
    return 0;
}

by ShadowBlood @ 2024-04-20 18:31:20

题目中有说输入行数的范围。

long long inp[100][3](你这个太小了)

【希望我没说错】


|