help!!!都是TLE!!!
查看原帖
help!!!都是TLE!!!
516242
chenhongyu20100506楼主2021/7/4 16:41
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int w(int a,int b,int c){
	if(a==15&&b==15&&c==15){
		return 32768;
	}
	if(a<=0||b<=0||c<=0){
		return 1;
	}else{
		if(a>20||b>20||c>20){
			return w(20,20,20);
		}else{
			return 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(){
	while(cin>>a&&cin>>b&&cin>>c){
		if(a==-1&&b==-1&&c==-1){
			break;
		}else{
			cout<<"w("<<a<<','<<b<<','<<c<<")="<<w(a,b,c)<<endl;
		}
	}
	return 0;
}
2021/7/4 16:41
加载中...