我!不!会!失!败!
2024-08-21 14:27:29
发布于:广东
6阅读
0回复
0点赞
yee?
#include<bits/stdc++.h>
using namespace std;
#define i64 long long
int arr[21][21][21]{};
i64 w(i64 a,i64 b,i64 c){
if(!(a < 21 && b < 21 && c < 21)) int yee = 1;
else if(arr[a][b][c]) return arr[a][b][c];
if(a <= 0 || b <= 0 || c <= 0) arr[a][b][c] = 1;
else if(a > 20 || b > 20 || c > 20) return 1048576;
else if(a < b && b < c) arr[a][b][c] = w(a,b,c-1) + w(a,b-1,c-1) + w(a,b-1,c);
else arr[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 arr[a][b][c];
}
int main(){
i64 a,b,c;
while(cin >> a >> b >> c && a != -1 && b != -1 && c != -1) printf("w(%lld,%lld,%lld) =%lld\n",a,b,c,w(a,b,c));
}
这里空空如也
有帮助,赞一个