xueruo @ 2022-11-06 10:47:03
//二分
//#include<iostream>
//using namespace std;
//const long long INF=2*(1e9+10);
//long long a,b;
//int main(){
// cin>>a>>b;
// long long mid,left=(0-INF),right=INF;
// while(left<=right&&mid!=(a+b)){
// mid=(left+right)>>1;
// if(mid<a+b)left=mid+1;
// if(mid>a+b)right=mid-1;
// }
// cout<<mid;
// return 0;
//}
//深搜
#include<iostream>
using namespace std;
long long a,b;
long long dfs(long long x){
if(x==1)return 1;
else return dfs(x-1)+1;
}
int main(){
cin>>a>>b;
cout<<dfs(a)+dfs(b);
return 0;
}
函数递归调用太多了,占空间溢出,求优化!!doge
by xueruo @ 2022-11-06 11:06:54
@tuantuan888 那个题排版不太好,建议用***弄一下
by Jerrlee✅ @ 2022-11-06 11:11:06
?啥玩意
为啥不能好好的写 A+B 呢。
by Lovely_Doggie @ 2022-11-06 12:41:03
bbbbbbb
by VitrelosTia @ 2022-11-06 15:31:14
@tuantuan888
请不要宣传私题。
你的题并不是什么绝世好题,没有
by Kaedehara__Kazuha @ 2022-11-07 13:07:07
用不着这么复杂吧。
#include<bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}
这下不就行了?
by CODINGWEI @ 2022-11-07 20:19:09
这不直接cout << a+b;它不香吗?
by _XHY20180718_ @ 2022-11-14 11:12:42
@fzt666 用得着。
by 心灵震荡 @ 2022-12-14 22:10:04
@tuantuan888 jbl
by Lovely_Doggie @ 2022-12-15 19:20:18
?
考古??
by xueruo @ 2022-12-30 11:32:11
2022-11-06不够古罢……