100分,但subtask#2还是RE了怎么回事
  • 板块P1464 Function
  • 楼主jango
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/3/29 00:23
  • 上次更新2024/3/29 15:15:54
查看原帖
100分,但subtask#2还是RE了怎么回事
998272
jango楼主2024/3/29 00:23
#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;
}
2024/3/29 00:23
加载中...