WA,why?????
  • 板块P1464 Function
  • 楼主chenshixue
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/12/23 14:21
  • 上次更新2023/12/23 16:28:57
查看原帖
WA,why?????
939292
chenshixue楼主2023/12/23 14:21
#include<bits/stdc++.h>

using namespace std;

int w(int a,int b,int 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(a<b&&b<c){
		return w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
	}
	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(){
	int a,b,c;
	while(cin>>a>>b>>c){
	    if(a==-1&&b==-1&&c==-1){
	    	break;
		}
		else cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<w(a,b,c)<<endl;
	}
	
	return 0;
} 

帮个忙求求了

2023/12/23 14:21
加载中...