hyylearn @ 2023-03-05 16:56:06
#include<bits/stdc++.h>
using namespace std;
int m[25][25][25]={0};
int w(int a,int b,int c)
{
if(a<=0||b<=0||c<=0)return 1;
else if(a>20||b>20||c>20)return w(20,20,20);
else if(m[a][b][c]!=0)return m[a][b][c];
else if(a<b&&b<c) return m[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else return m[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);
}
int main()
{
int a,b,c;
while(cin>>a>>b>>c)
{
if(a==-1&&b==-1&&c==-1)break;
cout<<"w("<<a<<", "<<b<<", "<<c<<")="<<w(a,b,c)<<endl;
}
return 0;
}
by AutomatiC__ @ 2023-03-05 17:00:38
右括号漏了两个空格,应该是") = "
by hyylearn @ 2023-03-05 19:59:59
@Hegemony 是我太粗心了,感谢大佬帮忙!!!