laozhang_123 @ 2023-12-17 11:32:53
#include<bits/stdc++.h>
using namespace std;
long long f[25][25][25];
long long w(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 w(20,20,20);
else if(f[a][b][c]) return f[a][b][c];
else if(a<b&&b<c)
f[a][b][c]=w(a,b,c−1)+w(a,b−1,c−1)-w(a,b−1,c);
else
f[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 f[a][b][c];
}
int main(){
long long a,b,c;
while(cin>>a>>b>>c){
if(a==-1&&b==-1&&c==-1)
break;
printf("w(%lld, %lld, %lld) = %lld",a,b,c,w(a,b,c));}
return 0;
}
评测记录
by I_will_AKIOI @ 2023-12-17 11:35:55
−换成-
by gfgoodluck @ 2023-12-17 11:36:29
字符有问题吧
by laozhang_123 @ 2023-12-17 11:39:11
@xinyu123 @gfgoodluck 谢谢大佬们,本帖完
by laozhang_123 @ 2023-12-17 11:41:18
所以我这是怎么打出来的
by gfgoodluck @ 2023-12-17 11:41:42
@laozhang_123 输入法问题?