二分a+b,40分

P1001 A+B Problem

touxi @ 2021-11-05 19:29:41

#include<bits/stdc++.h>
using namespace std;
long long a,b;
long long sb(long long x)
{
    if (x==1) return 1;
    else return sb(x/2)+sb(x-x/2);
}
int main()
{
    cin>>a>>b;
    cout<<sb(a)+sb(b);
    return 0;
}

怎么优化


by batmanzhan @ 2022-03-26 10:29:09

int a,b;

cin>>a>>b;

cout<<a+b;

~~这题太“难”了


by xiejunxi888 @ 2022-04-12 15:42:18

我笑了······


by yangtinghao @ 2022-07-07 17:01:22

我也用的二分,啊这


by batmanzhan @ 2022-07-22 17:17:55

为啥要二分


上一页 |