全部re求助!
  • 板块P1464 Function
  • 楼主WoodReal12
  • 当前回复12
  • 已保存回复12
  • 发布时间2023/7/30 10:51
  • 上次更新2023/11/3 06:57:10
查看原帖
全部re求助!
676569
WoodReal12楼主2023/7/30 10:51
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;
ll rec[25][25][25];
ll srh(ll a,ll b,ll c){
	if(a<=0||b<=0||c<=0)
		return rec[a][b][c]=1;
	else if(rec[a][b][c]!=0)
		return rec[a][b][c];
	else if(a>20||b>20||c>20)
		return rec[a][b][c]=srh(20,20,20);
	else if(a<b&&b<c)
		return rec[a][b][c]=srh(a,b,c-1)+srh(a,b-1,c-1)-srh(a,b-1,c);
	else
		return rec[a][b][c]=srh(a-1,b,c)+srh(a-1,b-1,c)+srh(a-1,b,c-1)-srh(a-1,b-1,c-1);
}
ll x,y,z;
int main(){
	while(scanf("%lld%lld%lld",&x,&y,&z)&&x!=-1&&y!=-1&&z!=-1){
		memset(rec,0,sizeof(rec));
		printf("w(%lld, %lld, %lld) = %lld\n",x,y,z,srh(x,y,z));
	}
	system("pause");
	return 0;
}
2023/7/30 10:51
加载中...