求助lambda递归写法
查看原帖
求助lambda递归写法
100325
peterwuyihong楼主2022/1/26 19:51

把这个改对即可,这个函数套函数不准拆开

#include<bits/stdc++.h>
using namespace std;
int G(int a,int b){
  auto GG=[&](int a){
    if(a==0)return 1;
    return 1+GG(a-1);
  };
  return GG(a+b);
}
signed main(){
  int a,b;
  cin>>a>>b;
  cout<<G(a,b);
}
2022/1/26 19:51
加载中...