szlh_XJS @ 2024-04-21 21:22:18
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll v[25][25][25];
ll w(int a,int b,int c)
{
if(a<=0||b<=0||c<=0)
{
return 1;
}
if(v[a][b][c]>0)
{
return v[a][b][c];
}
else
{
if(a>20||b>20||c>20)
{
return w(20,20,20);
}
else
{
if(a<b&&b<c)
{
v[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
return v[a][b][c];
}
else
{
v[a][b][c]=w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);
return v[a][b][c];
}
}
}
}
int main()
{
memset(v,sizeof(v),false);
ll a,b,c;
for(int i=1;;i++)
{
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1)
{
break;
}
printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w(a,b,c));
}
return 0;
}
by wolf_spray @ 2024-04-28 22:05:46
@szlh_XJS
因为你用了#define ll long long
所以你的main主函数要改为有符号型的signed main