WoodReal12 @ 2022-12-30 15:20:40
全RE了!
#include <iostream>
using namespace std;
int rec[25][25][25];
int x,y,z;
int fun(int a,int b,int c){
if(a<=0||b<=0||c<=0)
return 1;
if(rec[a][b][c]!=0)
return rec[a][b][c];
if(a>20||b>20||c>20)
return rec[a][b][c]=fun(20,20,20);
if(a<b&&b<c)
return rec[a][b][c]=fun(a,b,c-1)+fun(a,b-1,c-1)-fun(a,b-1,c);
return rec[a][b][c]=fun(a-1,b,c)+fun(a-1,b-1,c)+fun(a-1,b,c-1)-fun(a-1,b-1,c-1);
}
int main(){
while(cin>>x>>y>>z&&x!=-1&&y!=-1&&z!=-1)
cout<<"w("<<x<<", "<<y<<", "<<z<<") = "<<fun(x,y,z)<<endl;
return 0;
}
by aCssen @ 2022-12-30 15:54:38