玄关

P1464 Function

AlexSong @ 2024-01-31 10:03:07


#include<bits/stdc++.h>
using namespace std;
const int MAX_LEN=22;
typedef long long ll; 
ll w[MAX_LEN][MAX_LEN][MAX_LEN];
ll g(ll a,ll b,ll c)
{
    if(a<=0||b<=0||c<=0)
    {
        return 1;
    }
    if(a>20||b>20||c>20)
    {
        return g(20,20,20);
    }
    if(w[a][b][c])
    {
        return w[a][b][c];
    }
    if(a<b&&b<c)
    {
        return w[a][b][c]=g(a,b,c-1)+g(a,b-1,c-1)+g(a,b-1,c);
    }
    return w[a][b][c]=g(a-1,b,c)+g(a-1,b-1,c)+g(a-1,b,c-1)-g(a-1,b-1,c-1);
}

int main()
{
    ll a,b,c;
    while(~scanf("%11d%11d%11d",&a,&b,&c))
    {
        if(a==-1&&b==-1&&c==-1)
        {
            break;
        }
        printf("w(%11d,%11d,%11d)=%11d\n",a,b,c,g(a,b,c));
    }
    return 0;
}

by jesse1216 @ 2024-01-31 10:05:46

应该是 %lld 不是 %11d 啊。

while(~scanf("%lld%lld%lld",&a,&b,&c))
{
    if(a==-1&&b==-1&&c==-1)
    {
        break;
    }
    printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,g(a,b,c));
}

by jesse1216 @ 2024-01-31 10:06:12

@AlexSong


by jinglinbankemeng @ 2024-01-31 10:06:42

看私信!


by AlexSong @ 2024-01-31 10:08:09

已关,蟹蟹大佬们


by qusia_MC @ 2024-02-12 19:07:20

《%11d》额这是你手打的吗如果是你也太傻了吧不是的话你抄了谁的呢


by qusia_MC @ 2024-02-12 19:07:50

@AlexSong


|