题解:A+B problem
Shuhang_JOKER1 · · 题解
看到很多大佬在发题解,我也来一波搜索 ~
话不多说,看题解:
#include <bits/stdc++.h>
using namespace std;
int a, b, ans;
void dfs(int x, int y){
if(x<0){
ans+=x;
x=0;
}
if(y<0){
ans+=y;
y=0;
}
if(x==0&&y==0)
return;
ans+=2;
x--;
y--;
dfs(x,y);
}
int main(){
cin >> a >> b;
dfs(a,b);
cout << ans << endl;
return 0;
}