玄关
  • 板块P1464 Function
  • 楼主yiwugougou
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/13 19:53
  • 上次更新2024/8/13 21:46:33
查看原帖
玄关
1269609
yiwugougou楼主2024/8/13 19:53
#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 x,y,z;
    while(cin>>x>>y>>z && (x!=-1 || y!=-1 || z!=-1)){
        cout<<"w("<<x<<", "<<y<<", "<<z<<") = "<<w(x,y,z)<<endl;
    }
    return 0;
}

玄关

2024/8/13 19:53
加载中...